Coding a Tetris AI using a Genetic Algorithm
luckytoilet.wordpress.com
luckytoilet.wordpress.com
My senior year in high school I got hooked on an online multiplayer Tetris game called TetriNET. I eventually created a pretty sophisticated bot to play for me, which absolutely crushed the games. A friend recommended I submit it for consideration in the regional science fair, where I wound up taking first in the computer science category.
Lots of details on the blog [1], including screenshots, source code, and details of the algorithms used.
[1] http://www.mattmazur.com/2009/05/creating-a-tetrinet-bot/
As 'lincolnq said, standard hill-climbing would probably work much better for this kind of problem.
Still, cool results, I guess.
Still, they have pedagogical value because they are easy to implement, and for many students, are their first real soup-to-nuts "AI" algorithm implementation. I've seen them serve as the gateway for students to get into CS research, but IMO aspects such as the last resort principle, no free lunch theorem, and principles of stochastic optimization are generally under-stressed, which leads to some abhorrent research papers along the lines of "Problem X using GAs".
<grin> Besides, evolution is the optimization method that God chose. </grin>
That being said, amongst the possible candidates for search strategies, genetic algorithms are fairly lousy. Differential Evolution or CMA-ES would likely work far better.
More reasonable parameters would be 100-1000 for the initial population, and +/- 2% on a parameter for mutations.