The game of Upsetris is played just like the classic game of Tetris, but with a twist. Just like in Tetris, puzzle pieces, each made of four square bricks, fall from above and the user has to decide where they will land to try and make full rows of blocks. The game ends when the pile reaches the top of the screen.




In the game shown above, a straight vertical piece is falling. If the user drops it in the left most column (picture
If the player makes bad decisions about where to put pieces, they can end up with boards with "holes" in them as shown at above-right. These holes will eventually cost them the game.
In Upsetris, the "twist" (pun intended) is that the user has a one-time-only chance to "upset" the board by rotating it
Here's an example of the "upset" process in action:
| | | | | | | | | O OOO O| |O O OOOO | | O O OO O| | OO OOOOO | | OOOOO| |OO OOOOO O| |==========|
|==========| |O OOOOO OO| |OOOOO | | OOOOO OO | |O OO O O | | OOOO O O| |O OOO O | | | | | | | | |
| | |O OOOOO OO| |OOOOO | | OOOOO OO | |O OO O O | | OOOO O O| |O OOO O | | | | | | | |==========|
| | | | | | | | | OO | | OOO | |O OOO | |OOOOOO OO | |OOOOOO OOO| |OOOOOOOOOO| |==========|
| | | | | | | | | | | OO | | OOO | |O OOO | |OOOOOO OO | |OOOOOO OOO| |==========|
In the example above, the bricks are represented by capital O
's and the floor is a row of equal signs. The original board
The input contains five different Upsetris boards, each with from
Note that all the boards in the sample input are the same size and have the same number of rows as columns, but this might not be true of the data sets you will be judged on. The side characters for the board |
are ASCII code
Sample Input
| |
| |
|O |
|O OO O O |
| O O |
| O O OO |
| O OO|
|O O |
| O O O |
|O O |
|==========|
| |
| |
| |
| O |
| O OO O|
| O O|
| O O |
| OO |
|O |
| O O|
|==========|
| |
| |
| |
| |
| O OOO O|
|O O OOOO |
| O O OO O|
| OO OOOOO |
| OOOOO|
|OO OOOOO O|
|==========|
| |
| |
| |
| |
| |
| |
| |
| |
| O O |
| O O|
|==========|
| |
| |
| |
| |
|OO OO OOOO|
| O OOOOOOO|
|O OOOO OOO|
| OOOOOOOO |
|OOOO O O |
|O OOO OOO|
|==========|
Sample Output
| |
| |
| |
| |
| |
| |
| |
| O O|
| O O O O|
| OOO OO O|
|==========|
| |
| |
| |
| |
| |
| |
| |
|O O O |
|O O OO |
|OOOO OO O|
|==========|
| |
| |
| |
| |
| |
| OO |
| OOO |
|O OOO |
|OOOOOO OO |
|OOOOOO OOO|
|==========|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|O O O O |
|==========|
| |
| |
| |
| |
| |
| |
| |
| O O |
| OO OOO |
|OOO OOO OO|
|==========|
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments