Monday, December 28, 2009

Game of Checkers

It was my second semester at George Mason University and I took "Artificial Intelligence" course. As usual, the tedious part of any course is deciding the project. Finally, I decided to make "Checkers" game. I gathered complete information about the game and its rules. Thinking about the interface, designing game strategy, implementation (using C#) and testing was all done in 1.5 weeks.

Given the time limitation, I had to come up with a sufficiently intelligent game. Therefore, I decided to use defensive strategy.

Heuristic
The heuristic function is the diagonal distance from the square, onto which a computer can move its piece in its turn, to the nearest human piece. Hence, this distance is calculated for each of the possible moves available for computer. The move with the highest distance is chosen. If there is a jump move available, it is given the priority over all other possible moves regardless of the heuristic function.

The Game
Click here to download and play Checkers.

How to Play
At first, it is human's turn. The player should select his piece by clicking on it once. Then the player should select an empty square onto which he desires to move the selected piece. If the player makes an illegal move, he will be prompted with a message and will be required to make a legal move in order to proceed with the game. When the player has made a legal move, the computer will make its move and in this way both players would alternate among their turns. This will go on until one of the players is wiped off the board.

Any suggestions for refinement, especially the intelligence part, are most welcome.

No comments:

Post a Comment