You are working on a part of Tetris! playing AI that figures out the best move for the current piece, and one part of the information required for this decision is knowing the maximum number of lines that the current piece can score on a given board.
The board size is 10 units in width, and 6 in height. A line is complete when all 10 units across are filled with a game piece. It is made up on 2 possible characters:
- # - piece on a board
- . - empty spot
Pieces in play are standard Tetris pieces, and the current game piece will be described in a 4 by 4 matrix, at the beginning of each data set. The pieces can rotate, and thus can be presented in any orientation. Same character map as the board applies. For example:
.... .##. ##.. ....
The input file DATA5.txt will come in 5 sets, repeating the following pattern: 4 lines, 4 characters each, describing the current piece in play. Followed by 6 lines, 10 characters each, describing the current board.
The output file OUT5.txt will contain 5 lines -- a maximum number of lines that a piece can score.
Note: The piece starts dropping from above the supplied 6x10 board, and cannot be moved sideways during the fall. That is, you need concern yourself only with the vertical drop.
.... .#.. .### .... .......... .......... .......... #####..### ##.##.#### #####.####
2