TETRISIN - Interactive Tetris
You spent the last 3 months playing Tetris, and in order to be able to change activity, you decided to write a program that will play Tetris for you. Tetris is a game played on a grid with 24 rows and 12 columns. Columns are numbered from 0 to 11. Tiles are falling one by one from the top row. A tile is a connected set of 4 cells. There are 7 different tiles as depicted in this figure. Tiles types are numbered from 1 to 7.
In each round of the game, you obtain a tile, identified by its type number P. Then you decide on some rotation R of the tile, and a column C, where it should be dropped. The integer R is between 0 and 3 inclusive and specifies how many times the tile should be rotated clockwise. The specification of column C, means that it is first aligned such that its leftmost cell is in column C. Then the tile will move down until it hits the bottom of the grid, or touches another tile, preventing it from moving further.
Once the tile reached its current position, rows which are completely covered by tiles are removed from the grid, and cells above the eliminated row fall further down. If 4 successive rows are elimited, the score of the game is increased by 8. This is called a Tetris round. If the previous round was already a Tetris round, then the score is increased by 12 instead. Otherwise every eliminated row contributes 1 point to the score.
The game ends either when the first four rows are not empty, or when the limit of 10000 rounds is reached.
Pièce 1 1111Pièce 2 2222Pièce 3 3333Pièce 4 4444Pièce 5 5555Pièce 6 6666Pièce 7 7777
Input/Output
In each round you should read a line containing an integer P. If P equals 0, the game finishes and you can stop the program. Otherwise P indicates one of the 7 tile types. In response you should output a line with two space separated integers R and C as described above.
Example
In the following example the program obtained a score of 0 points, and the final state is the following grid.
Input/Output:
1
0 0
2
0 1
3
0 2
1
1 5
4
0 3
5
0 4
6
0 5
7
0 6
6
0 8
6
1 10
6
0 9
6
0 8
6
0 9
6
0 8
6
0 9
6
0 8
6
0 9
6
0 8
6
0 9
0
Added by: | xtof |
Date: | 2023-03-24 |
Time limit: | 1s-10s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | https://journees-franciliennes-de-programmation.org/jfp12/ |