For my optimization class last semester, I built an entire chess game using HTML and JavaScript. I also wrote an artificial intelligence algorithm to play as a computer player. My algorithm has about 20 different parameters it uses to score each move and decide which move it should take. For my optimization class project, I then wrote a real-value genetic algorithm with to optimize these 20 parameters to find the “best” settings for the computer player.
My algorithm here only does a two-ply (easy setting) or a three-ply (hard setting) search. With more computing power, this could be increased to improve the “skill” of my computer player. I ran my genetic optimization algorithm on the two-ply search, and that alone took a pretty significant amount of computing time:
Total Generations: | 31 |
Total Players: | 128 |
Games Played: | 1,832 |
Turns Taken: | 637,900 |
Processing Time: | 3,830 core-hours (160 continuous days) |
There are still a few small bugs that need to worked out (castling sometimes doesn’t work properly, en passant isn’t possible, and a stalemate is treated as a checkmate). But overall, it’s been a fun project to work on!
Click here to play a live demo!
(Of course, this game is fastest in Chrome, and awfully slow in Internet Explorer.