Problem Solving Assignment 9
TextTris.java
Overview
TextTris.java is a static class that allows you to step through the game
step by step and have absolute control over the game so that you can test
your collisions and line finding logic. What follows is a description on how
to use it
Running it
In the terminal in your psa9 folder enter java TextTris or
java TetrisWindow -t
You should see a text board pop up (you probably want to maximize your
screen)
example:
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
The instructions are hopefully fairly straight forward.
Example run, trying to move a piece out of bounds on the left:
bash-2.05b$ java TetrisWindow -t
setting print text to true
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
p
..........[]........
........[][]........
........[]..........
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
a
........[]..........
......[][]..........
......[]............
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
a
......[]............
....[][]............
....[]..............
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
a
....[]..............
..[][]..............
..[]................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
a
..[]................
[][]................
[]..................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
a
..[]................
[][]................
[]..................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
--------------------
Usage of TextTris: MAXIMIZE YOUR TERMINAL
a for movePieceLeft() s for movePieceDown() d for movePieceRight() g for rotateCW()
h for rotateCCW() # for a particular piece v for findLines() b for shiftLinesDown()
p for put a random piece x for System.exit q for add a random line w for add random blocks
c for clear screen
No exception means that everything went well.