Tetris
This version of Tetris is a fully feature complete game, and has an included AI that can play Tetris very well by simulating the future state of the game.
About this version of Tetris
This version of Tetris, unlike many "simple" online versions uses standard SRS, the correct Random Bag 7 Piece Generator, and accurate ARE, DAS, ARR, and Lock Delay.
In other words, it should "feel good". It's also customizable, but be aware the AI is trained on the default settings.
About the AI
The AI ("Take B") is an algorithmic AI that searches n moves into the future in order to maximise it's score via board herustics.
The board heuristics include:
- Aggregate Height
- Number of Lines Completed (in the future)
- Number of holes on resulting board
- Bumpiness of the board
- Score generated
- Game over?
These are only calculated once the entire game has been simulated with the provided movelist. Each herustic is weighted by a coefficent chromosome, which was created from a genetic algorithm. This gives each move set a score.
The AI simply picks the best scoring moveset each time it runs out of moves in it's move queue. It puts all the moves from the moveset onto it's queue. This has the downside of the AI not re-evaluating the state of the board until it runs out of moves. It also has difficulty looking into the future, and is greedy.
The AI picks which moves to perform by first moving the tetrimino to each x coordinate, and then performing any combination of random moves. It has some optimizations to prevent dumb stuff, such as pressing left one frame, then pressing right (essentially, a null operation), or rotating left then right.
Future optimizations to the AI
- Make randomly picked moves chance part of the chromosome
- On every hard drop randomly generated, try and scan every x position again (essentially, simulating the next piece).
- Reward tetris's (when line clear = 4)
- Consider delay state (when we can actually move, consume AI input...)
TODO
- Fix: Ground Lock Delay
- Fix: Soft Drop Scoring
- BUG: Can move if spawn in block
- Sound
- Effects
- Enable / Disable Hold
Category: Games