Checkers AI Algorithm
Posted
by
John
on Game Development
See other posts from Game Development
or by John
Published on 2012-06-02T23:45:41Z
Indexed on
2012/06/03
4:49 UTC
Read the original article
Hit count: 426
I am making an AI for my checkers game and I'm trying to make it as hard as possible. Here is the current criteria for a move on the hardest difficulty:
1: Look For A Block: This is when a piece is being threatened and another piece can be moved in behind it to protect it. Here is an example:
Black Moves
|W| |W| |W| |W| |
| |W| |W| |W| |W|
|W| | | |W| |W| |
| | | |W| | | | |
| | | | |B| | | |
| |B| | | |B| |B|
|B| |B| |B| |B| |
| |B| |B| |B| |B|
White Blocks
|W| |W| |W| |W| |
| |W| | | |W| |W|
|W| |W| |W| |W| |
| | | |W| | | | |
| | | | |B| | | |
| |B| | | |B| |B|
|B| |B| |B| |B| |
| |B| |B| |B| |B|
2: Move pieces out of danger: if any piece is being threatened, and a piece cannot block for that piece, then it will attempt to move out of the way. If the piece cannot move out of the way without still being in danger, the computer ignores the piece.
3: If the computer player owns any kings, it will attempt to 'hunt down' enemy pieces on the board, if no moves can be made that won't in danger the king or any other pieces, the computer ignores this rule.
4: Any piece that is owned by the computer that is in column 1 or 6 will attempt to go to a side. When a piece is in column 0 or 7, it is in a very strategic position because it cannot get captured while it is in either of these columns
5: It makes an educated random move, the move will not indanger the piece that is moving or any piece that is on the board.
6: If none of the above are possible it makes a random move.
This question is not really specific to any language but if all examples could be in Java that would be great, considering this app is written in android. Does anyone see any room for improvement in this algorithm? Anything that would make it better at playing checkers?
© Game Development or respective owner