in Game Development

Draughts AI – My Approach

I am happy to say that I have finished programming my Draughts game. If you have been following my Twitter then you may have noticed that there is one thing holding me back from releasing it, memory leaks. I personally expected to have a few since I haven’t had a great deal of experience writing more sophisticated applications in C/C++. I got around to checking these leaks the day before I was heading back to University for the semester so I haven’t been able to address all of them yet but plan to soon. For the mean time I would like to discuss the AI that I have used in this game.

One of the fundamental concepts behind AI is the Turing Test as discussed in Alan Turing’s 1950 paper “Computing Machinery and Intelligence“.

A human judge engages in a natural language conversation with one human and one machine, each of which tries to appear human. All participants are placed in isolated locations. If the judge cannot reliably tell the machine from the human, the machine is said to have passed the test. In order to test the machine’s intelligence rather than its ability to render words into audio, the conversation is limited to a text-only channel such as a computer keyboard and screen.

With this in mind I decided to brainstorm several things that would cause my game to fail this Turing Test. The first notable thing is moving a piece into a position in which the opponent can jump that piece when there are other more advantageous positions on the board. The second is if the computer player doesn’t take the obvious jumps and double jumps. To put these into play I decided to assign a priority to all of the possible moves that a computer opponent could take. Any moves which resulted in capturing an opponents piece would would receive an increase in priority and any moves that resulted in being captured by the human player resulted in a decrease in priority. The computer would then take a random move out of the list of moves with the highest priority.

The system described above is the crux of the AI. Overall effect works really well towards the start of the game but sort of falls apart as the pieces become scattered across the board since the AI moves pieces at random. I’d like to think that the aggressiveness of the computer early on makes its flaws less apparent towards the end but this not always the case.

Thanks for reading. Hopefully towards the end of this week you should be seeing the source code of Draughts here. For now enjoy some of these screen shots.

Write a Comment

Comment