Skip to content

Cannon Game engine and AI player based on NegaMax with Alpha Beta pruning with transposition table using Zobrist hasing

Notifications You must be signed in to change notification settings

kurshakuz/CannonAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cannon game

This is a game GUI engine for Cannon board game developed using Python and pygame. Cannon is a two-player board game invented in 2003 by David E. Whitcher. Rules are available here.

The implemented GUI allows to play for two human players, for one human player and one AI player, and for two AI players. Visuals are shown below: gui1

This game engine contains a various number of AI implementations to play against a human player. Following AI engines with enhancement were developed:

  • Random player AI
  • Vanilla MiniMax
  • Vanilla NegaMax
  • MiniMax with Alpha Beta pruning
  • NegaMax with Alpha Beta pruning
  • Transposition table for alpha beta algorithm using Zobrist hasing
  • Variable depth search with time constraints

Requirements

pip3 install pygame

Start the game

python3 CannonMain.py

Choose player role

If you want choose for human or AI to play for the red or black, assign according boolean in CannonMain.py on lines 29-33.

Change AI algorithms

Choose desired AI algorithm, by uncommenting it on lines 109-115 in CannonMain.py. You can change the maximum depth by changin maxDepth variable. You can also change maximum search time for the iterative deepering search by changing maxTime variable.

About

Cannon Game engine and AI player based on NegaMax with Alpha Beta pruning with transposition table using Zobrist hasing

Resources

Stars

Watchers

Forks

Languages