The deadline for this lab is Wednesday 13 April 2005, 17:45 hours. Strictly no submissions will be accepted after the deadline.
.... .X.. Rotation 1 XXX. .X.. .XX. Rotation 2 .X.. ..X. .XX. Rotation 3 ..X. .... .XXX Rotation 4 ..X.
Here are some examples showing the rotation number and the position (column number) of a T block. Each T block is placed in an empty playing area.
........ ........ ........ ........ ........ Rotation 1, Position 0 ........ .X...... XXX..... ........ ........ ........ ........ ........ Rotation 1, Position 1 ........ ..X..... .XXX.... ........ ........ ........ ........ ........ Rotation 2, Position 0 X....... XX...... X....... ........ ........ ........ ........ ........ Rotation 3, Position 2 ...X.... ..XX.... ...X.... ........ ........ ........ ........ ........ Rotation 4, Position 5 ........ .....XXX ......X.
........ ........ ........ ........ ........ Rotation 4, Position 0 ........ XXX..... .X...... ........ ........ ........ ........ ...X.... Rotation 1, Position 2 ..XXX... XXX..... .X......
0 1 5 1 0 2 6 3 1 4 4 4
The above shows that the first T block has rotation 1 and is dropped at position 0, the second T block has rotation 1 and is dropped at position 5, and so on. No error checking is required; you may assume that the rotation and position numbers always keep the entire T block within the 8 x 8 playing area. You may also assume that we will not put too many T blocks such that they overflow from the top of the playing area.
We will test your program with other text files.
Follow the sample run exactly or you will not get any marks for the test cases. The UNIX prompt is shown by the $ sign.
$ gcc -Wall tetris.c -o tetris $ ./tetris T block dropped at position 0, rotation 1: ........ ........ ........ ........ ........ ........ .X...... XXX..... T block dropped at position 5, rotation 1: ........ ........ ........ ........ ........ ........ .X....X. XXX..XXX T block dropped at position 0, rotation 2: ........ ........ ........ ........ X....... XX...... XX....X. XXX..XXX T block dropped at position 6, rotation 3: ........ ........ ........ ........ X......X XX....XX XX....XX XXX..XXX T block dropped at position 1, rotation 4: ........ ........ ........ ........ XXXX...X XXX...XX XX....XX XXX..XXX T block dropped at position 4, rotation 4: ........ ........ ........ ........ XXXXXXXX XXX..XXX XX....XX XXX..XXX $
Remember to submit your program using the submit tetris.c command, and check your submission using the check command.
All the best!