A Java-based Tetris program, by Joakim Tengstrand. The tool is used to optimize Tetris algorithms.
- Java JDK (Java 8 or later)
To build the project, run:
./build.shThis will compile all Java source files into the build/classes directory.
The program requires two YAML configuration files as arguments:
- System settings file (
system.yaml) - Contains tetris rules, piece generators, and board evaluators - Race settings file (e.g.
example/five-games-parameter-areaWidthFactor1.yaml) - Contains game configuration and parameters
Using the provided system and race example files:
./run.sh example/system.yaml example/five-games-parameter-areaWidthFactor1.yamlOr manually:
java -cp "build/classes:lib/yamlbeans-1.08.jar" \
com.github.tetrisanalyzer.gui.TetrisAnalyzer \
example/system.yaml \
example/five-games-parameter-areaWidthFactor1.yamlReplace the YAML file paths with your own configuration files:
./run.sh path/to/your/system.yaml path/to/your/race.yamlFilled cells: The vertical bar shows how many filled cells correspond to the selected x-position on the graph. Use the arrow keys (left/right) to move the vertical bar. The Tetris board is updated accordingly.
The further to the left a graph is positioned (i.e., a larger proportion of positions with fewer filled cells), the lower the board height, indicating better and safer AI play. The AI also needs to maintain low board heights across different game states, which will shift the graph further to the left.
Zooming: Zooming makes it easier to compare different parameter settings.
- Comparing the top of the graph can be useful to see which graph is furthest to the left, indicating how well it performs on low boards.
- Comparing the slope to the bottom right can be useful to see which graph reaches the lowest point, indicating how well it performs on high boards.
- Select the area you want to zoom in on, with the mouse.
- Click right + left mouse button (at the same time) to zoom out.
![]() |
![]() |
Bookmarks (Zoom shortcuts):
- Save bookmark: Press
Ctrl+[1-9]to save the current zoom position - Jump to bookmark: Press
[1-9]to jump to a saved bookmark, and press it again to go back - Overview: Press
0to zoom out to overview
Saving and Resuming:
- Save manually: Press
Sto save the current game state to the race YAML file - Save on close: If the
save on closeparameter is set totruein the race YAML file, the state will automatically be saved on close (this is set tofalsein the example file). - Resume: When you restart the program with the same race YAML file, it will resume from the saved position, continuing with the same number of games, pieces, rows, board state, and piece generator state.


