The game of checkers is considered a complicated game with possible legal positions in the English draughts version ( board) alone (much more on higher dimensions). In this attempt to create a game agent, a tree traversal approach has been used. This approach is not only fast but also efficient given that good heuristics are used. The agent has been created which is capable of playing the game of draughts or checkers with a remarkable win rate against average players. Draughts is a 1vs1 zero-sum game. Minimax or Minimax algorithm is best suited for such types of games. Following is the development procedure practised during the development of the project.
- Implemented a basic Minimax Agent with limited depth.
- Applied ⍺-β pruning.
- Improved the evaluation functions.
Two types of evaluation functions have been used depending upon the state of the game. These are mid evaluation and end game evaluation function. Following is the report for the same. List all the evaluation functions:
Where and are the player’s and opponent’s pawns and and are the player’s and Opponent’s Kings respectively.
Where and are the player’s and Opponent’s Pawns in their own respective halves and and are their Pawns in their respective enemies halves. and are the player’s and Opponent’s Kings respectively.
Where and is the player’s and Opponent’s Pawns and and are the player’s and Opponent’s Kings respectively. , are the row number of the respective piece.
Where and is the player’s and Opponent’s Pawns in their own respective halves and and are their Pawns in their respective enemies’ halves. and are the player’s and Opponent’s Kings respectively. is the number of pieces on the board.
= Distance of ith king of the player from jth King of the adversary.
where is total number of kings of the player in the board and is total number of kings of the adversary in the board.
Minimise if player has more number of pieces than adversary else maximise.
= Distance of ith King of player from jth King of the enemy.
where is total number of kings of the player in the board and is total number of kings of the adversary in the board.
Minimise if player has more number of pieces than adversary else maximise.
First install Requirements
pip3 install -r requirements.txt
python3 main.py
You can tweak the parameters of the game bot from main file
- Heuristics can be drastically improved by adding specific features.
- The depth of the game tree has a significant influence on the quality of the computer player.
- There's a tradeoff between calculation time and quality of the game.
- It is not efficient to use Minimax without optimizations while with them it can be a good solution.
- Alpha-Beta pruning is exponentially improving in comparison to Minimax as the depth grows.
- Certain heuristics are clearly better than others but some of the “bad” ones still work well in some cases.
- Two player draughts game template has been taken from Pygame-Checkers
Found a bug? Create an issue.