Checkers game with basic AI in J2ME
I bought a pretty awesome book called “Artificial Intelligence for Games” by Ian Millington and thought that it would be fun to make a simple checkers game for J2ME using the negascout algorithm that the book teaches.
As always I had a lot of fun designing the UI and I made a checkers board and pieces using 3D Studio Max which were then edited into a spritesheet using Photoshop. Here are a few screenshots from the game:
From the main menu you can choose between starting as the black or red counter. You can select player versus cpu or player versus player.
Here is a recording of a playthrough where I play against the “Novice” difficulty CPU. The counter movement animations are rendered much more smoothly on my phone than in the following animated GIF:
Disclaimer - I am pretty bad at playing checkers!
Each player is an instance of either a human or computer controlled player class. This makes it easy to switch between different AI algorithms. Initially I had implemented this using the minimax algorithm but then later switched over to the negascout algorithm.
The AI seems to behave quite well until there are just a few of the promoted counters remaining and then the game seems to become impossible to win for either player. I am sure that I am probably missing important gameplay strategies!
I designed three different skins for the checkers board and the counters which can be selected from the main menu:
This was a fun project; I was able to create something a little more visually interesting than previously with my “Worm” game and even introduced a dash of basic board game AI. More importantly I actually have a hard time beating the AI.