TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Coding a Tetris AI using a Genetic Algorithm

48 pointsby mukyuabout 14 years ago

6 comments

matt1about 14 years ago
Similar story...<p>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.<p>Lots of details on the blog [1], including screenshots, source code, and details of the algorithms used.<p>[1] <a href="http://www.mattmazur.com/2009/05/creating-a-tetrinet-bot/" rel="nofollow">http://www.mattmazur.com/2009/05/creating-a-tetrinet-bot/</a>
lincolnqabout 14 years ago
I would be interested to see whether a genetic algorithm performs better than a hill-climbing one in this context. By hill-climbing I mean searching for a vector in the seven-dimensional space you've defined which makes the biggest improvement in the fitness function. I tend to think hill climbing would converge faster than evolution among random mutations.
评论 #2594690 未加载
apuabout 14 years ago
I hate to be "that guy", but I'm somewhat confused why everyone online seems to be so obsessed with genetic algorithms. What they are is a kind of optimization technique, and one of the worst ones at that. (Genetic algorithms are what you resort to in the rare cases when no other optimization technique will work.)<p>As 'lincolnq said, standard hill-climbing would probably work much better for this kind of problem.<p>Still, cool results, I guess.
评论 #2594692 未加载
评论 #2595170 未加载
评论 #2594614 未加载
评论 #2594702 未加载
评论 #2594887 未加载
mddaabout 14 years ago
Population size of 16 is <i>way</i> too low : it's not surprising that he's getting premature convergence. Also, his mutation is huge : so his overall process is more like a directed random walk.<p>More reasonable parameters would be 100-1000 for the initial population, and +/- 2% on a parameter for mutations.
uberstuberabout 14 years ago
<a href="http://www.ryanheise.com/tetris/tetris_artificial_intelligence.html" rel="nofollow">http://www.ryanheise.com/tetris/tetris_artificial_intelligen...</a> here's one using Google's pagerank algorithm
positr0nabout 14 years ago
That is very impressive for a 16 year old.