Tetris AI Design Specicaon
Table of Contents
Instrucon............................................................................................................................................... 1
Data structure..........................................................................................................................................1
Block....................................................................................................................................................1
Status of Block.....................................................................................................................................1
Link-array.............................................................................................................................................2
Board...................................................................................................................................................3
TempBoard..........................................................................................................................................3
Algorithm................................................................................................................................................. 5
Algorithm 1..........................................................................................................................................5
Algorithm 2..........................................................................................................................................7
Performance............................................................................................................................................8
For the contest........................................................................................................................................ 8
Instruction
This specification is specific to the structure and the algorithm of my Tetris AI program. My program
can’t evaluate advanced blocks; it only decides which status is the best for the current block. In other
words, it not smart enough. But it plays better than I.
Data structure
Block
A Block is stored in an array with 4 *2 sizes. The first element of this array is the base point, assigned
with (0,0). And the other 3 points are stored with their offset to this point (offsetX,offsetY) . The first
element of the array is always the lowest point, while the last element is the highest.
For example, the square block will be stored like following:
//xx
//xx
int offsetB1S1[4][2]={{0,0},{1,0},{0,1},{1,1}};
Status of Block
Every block can be turned 0, 90, 180 and 270 degrees. That indicates a block always with 4 different
statuses. A status should contain the block itself, the position of the block and the current direction of
1