I built the game Connect 4 (More details about the rules can be found here: https://en.wikipedia.org/wiki/Connect_Four) in which the AI uses Game Tree based search to play against (and beat) a Myopic player (looks only one move ahead before choosing the best action). To run the game, run the PlayGame file (doesn't require any inputs).
- The Myopic player always makes the first move.
- The Game tree looks 5 moves ahead (i.e. game Tree has a cut-off depth of 5).
- I experimented with multiple evaluation functions and compared their performance based on the number of games won (out of 50 games) and the average number of moves before each win.
- The Minimax function is implemented with alpha-beta pruning to speed up the process.
- A comparison between implementation with and without a move ordering heuristic has been shown.
- FourConnect: Outlines the gameplay and the Myopic Players' moves. Called in the PlayGame file.
- PlayGame: Implements Game Tree-based search to find out the best move for the AI and contains the main function to be run.
- Different evaluation functions used and their performance.
- The move ordering heuristic used and the difference it makes to the performance.
A file outlining the methods and their functions used in the two code files has also been uploaded.