This is a Tunnel Checkers with AI player on one side, implemented in Python.
The goal is as a complete game-play software that plays tunnel checkers with an opponent.
- GUI interface using tkinter
- Enable history "undo" for all steps
- No extra packages used
- Minimax & Alpha-Beta pruning with depth = 4 for searching moves
Start the game
python3 game.pyIt requires Python3
No dependencies required.
Run the following commands to clone the repository and install Tunnel Checkers:
git clone https://github.com/davidychen/TunnelCheckers.git
cd TunnelCheckers/This will link the cloned directory to your local.
The library contains the following files:
- game.py: this file contains a the canvas including resizing, mouse and buttons interaction
- Game: class for all GUI functions with a
__main__to run
- Game: class for all GUI functions with a
- board.py: this file contains all game rules
- GameBoard: The GameBoard is represented by a 2D array with dimensions 8x8. The top-left corner is assigned (0,0), and the bottom right corner is assigned (7,7). Player one's pieces start at the top of the board (rows 0, 1, 2) and the forward direction of this player is indicated by successively increasing row numbers. In contrast, player two's pieces start at the bottom (rows 5, 6, 7) and the forward direction of this player is indicated by successively decreasing row numbers.
- Cell: Has type as determine the color of the cell and may or not contain a piece
- Piece: With information about the position this piece is, which player it belongs to and whether it is a king
- minimax.py: The basic AI model to be used recursively searches the decision tree of the current game to a certain depth (e.g. when depth=4, predict 4 moves ahead in total), then comparing different paths in these trees and pick one that has the best payoff.
- Minimax: Using Alpha-Beta to get more efficient calculation on minimax; Heuristic function by counting piece, giving bonus to king (before being a king, bonus to how close to other end), and bonus to all pieces if they stay closer to each other.
