Corwin's TetrJS

HOLD

Score: 0

Lines: 0

Level: 0

Controls

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:

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 optimizatons to the AI

TODO

Learned Lessons

One of the worst things you can do for performance in Javascript is a deep clone. Doing a deep clone with multi-dimenstional arrays is the worst - I wrote a custom method to handle this case elegantly with Array.slice()

Some assets used from Puyo Puyo Tetris, which are (c) Sega