CS430: Programming Assignment 1 (Due Wednesday, October 15)
In the popular game of Tetris, we are given an initial m-by-n gameboard
(typically 20-by-10, or 20 high and 10 wide), which is a partially
filled rectangular grid. In the easiest version of the game, the
gameboard is initially empty. The player is given, one by one, a piece
consisting of four filled squares arranged in one of seven possible
tetrominos (square, L, backwards L, I, T, S, and Z). Each piece
begins in the middle of the top row of the game board, and falls
downward at a constant speed. As it falls, the player can rotate the
piece and slide it horizontally. If, when the piece comes to rest, all
gridsquares in an entire row h of the gameboard are filled, row h is
cleared: all rows above h fall one row lower and the top row of the
game board is replaced by an entirely unfilled row. As soon as a piece
is fixed in place, the next piece appears at the top of the
gameboard. In some implementations, a one piece lookahead is provided: when the
ith piece begins falling, the identity of the i+1st piece is
revealed. A player loses when a new piece is blocked by filled
gridsquares from entering the gameboard. The player's objective is to
maximize the number of rows cleared. Write down condition action rules
for a reactive agent that plays a good game of Tetris.
Using one of the many free downloadable versions of Tetris (in Java)
available on the web, implement your agent and report the scores it
achieves on the standard Tetris game. Here are pointers to two
downloadable versions: