The pseudocode for implementing minimax has been referred from GeeksforGeeks. The link is - https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-4-alpha-beta-pruning/
Following libraries have been used in the project and should be insatlled before running-
numpy
matplotlib
random
torch
copy
re
- Run PlayChess.py
- You will be prompted to choose the board size-
Select from the following board sizes
- 4x4
- 5x5
- 6x6
- 7x7
- 8x8
Choose the desired option number. For eg, if you want to play with 6x6 board, enter 2 as your choice
- Then you will be prompted to choose the mode for each player -
Select mode of each player:
- Player 1 - Human Controlled Player 2 - Human Controlled
- Player 1 - AI Controlled Player 2 - Human Controlled
- Player 1 - AI Controlled Player 2 - AI Controlled
Choose the desired option number, as explained earlier.
- In case of human controlled player, Player will be prompted as follows- Provide the input as coordinates on the board with format r,c. All indexes are zero based. For eg, you wan to move piece at (4,0), give input as 4,0
- The program shows you list of possible move and swaps, and asks for target position, like as follows - Enter which piece you want to move 4,0
Possible Moves:
[(3, 0), [(5, 0), (5, 1), (5, 3), (5, 4), (5, 5)]]
Possible Swapes:
[(5, 0), (5, 1), (5, 3), (5, 4), (5, 5)]
Enter target position
- Choose target position from given options and enter in the same format as before, For eg - 5,1
- The game will go on till there is a winner.
- Choose option 3 to play with a tree based AI.
- Choose option 3 to make baseline AI and Tree bAsed AI to play with each other.
- Final score and winner is printed in the end, like -
Score of Player 1 - 240
Score of Player 2 - 1390
Winner of the game is White
- This program will prompt the user with following options
Select from the following board sizes for experiment
- 4x4
- 5x5
- 6x6
- 7x7
- 8x8
- Choose the desired option number, and experiment of 100 games on thte respective board size will be executed.
- Three graphs are plotted in the end, one after the other in the order of - White Player final scores, Black player final scores, Node Counts
- This program will train and test the CNN and plot a learning curve.
- The default depth can be changed to 1 or 2 while conducting experiments.
- Then the experiment with 6x6 board size start running.
- Three graphs are plotted in the end, one after the other in the order of - White Player final scores, Black player final scores, Node Counts