This Meetup is past

5 people went

Details

Join us for a laptop (tablets too, if you can compile code on it!) event at Kyocera's offices in UTC on Thursday, Sept 13 (6:00-8:00). This event will be interactive and involves code development, and limited to 12 people. For those without a portable development machine, I'll post the code after the event. If you really want to come without a computer to see other people type and mouse around, we can probably have some chairs set up too.

We will be reviewing the problem proposed at:

http://code.google.com/codejam/contest/544101/dashboard#s=p0

People are encouraged to attempt to solve the program before the meeting. The meeting should be walking through the solutions of the attendees, or debugging of their programs. Any language / platform for a solution. Last time we had Java / C++ / Python solutions.

Thursday 13 Sep 2012

Kyocera Communications

9520 Towne Centre Drive

San Diego, CA 92121

Limit of 12 attendees

Problem

In the exciting game of Join-K, red and blue pieces are dropped into an N-by-N table. The table stands up vertically so that pieces drop down to the bottom-most empty slots in their column. For example, consider the following two configurations:

- Legal Position - ....... ....... ....... ....R.. ...RB.. ..BRB.. .RBBR.. - Illegal Position - ....... ....... ....... ....... Bad -> ..BR... ...R... .RBBR.. In these pictures, each '.' represents an empty slot, each 'R' represents a slot filled with a red piece, and each 'B' represents a slot filled with a blue piece. The left configuration is legal, but the right one is not. This is because one of the pieces in the third column (marked with the arrow) has not fallen down to the empty slot below it.

A player wins if they can place at least K pieces of their color in a row, either horizontally, vertically, or diagonally. The four possible orientations are shown below:

- Four in a row - R RRRR R R R R R R R R R R R In the "Legal Position" diagram at the beginning of the problem statement, both players had lined up two pieces in a row, but not three.

As it turns out, you are right now playing a very exciting game of Join-K, and you have a tricky plan to ensure victory! When your opponent is not looking, you are going to rotate the board 90 degrees clockwise onto its side. Gravity will then cause the pieces to fall down into a new position as shown below:

- Start - ....... ....... ....... ...R... ...RB.. ..BRB.. .RBBR.. - Rotate - ....... R...... BB..... BRRR... RBB.... ....... ....... - Gravity - ....... ....... ....... R...... BB..... BRR.... RBBR... Unfortunately, you only have time to rotate once before your opponent will notice.

All that remains is picking the right time to make your move. Given a board position, you should determine which player (or players!) will have K pieces in a row after you rotate the board clockwise and gravity takes effect in the new direction.

Notes

You can rotate the board only once. Assume that gravity only takes effect after the board has been rotated completely. Only check for winners after gravity has finished taking effect.