Area-filler is a game played by placing colored tiles on cells of a two dimensinoal rectangular board. On each turn, you place a single tile of the color you choose onto an empty cell. After each turn, the computer will place two tiles, of randomly selected color, into unoccupied cells on the board.
You score points by placing tiles in such a way that four tiles on the board, all of the same color, form the corners of a rectangle with no tiles of any other color along the edges or interior of the rectangle. After a move is made that completes such a rectangle, the entire area is acquired, and the computer will no longer make any moves in that area.
The game is over when all spaces of the board have either been filled with a color, or acquired by completing the corners of a rectangle.
The init method will first be called, giving you basic parameters for the problem. You may return any int. Then, each call to nextMove will give you the current state of the board, where each element represents a row of the board, and each character a square within that row. A '.' represents an unoccupied square, a '*' is an already acquired square, and colored squares are given by 'A', 'B', 'C', etc. The nextMove method should return an int[] with three elements: *row*, *column*, and *color*, describing the next color (1-based) you wish to place, and where you wish to place it.
Your score for each test case will be the total number of squares that have been acquired. Note that the corners (or any interior squares that happen to have been the same color already) do not count as acquired. Thus, when you complete the four corners of a 3x4 rectangle, you would acquire a total of 8 squares.
Your total score will be the sum of your relative scores on each test case, where each relative score is YOURS / BEST. On any test case where you make an invalid return, or generate an error, you will score a 0.
A visualizer is available. |