A python implementation of the connect 4 game with an AI opponent based on the minimax algorithm with alpha-beta pruning.
This implementation is based on Keith Gali's tutorials:
https://www.youtube.com/watch?v=8392NJjj8s0&list=PLWKjhJtqVAblStefaz_YOVpDWqcRScc2s&index=9 and https://www.youtube.com/watch?v=XpYz-q1lxu8
- connect4_no_ai.py is the version of game with pvp and no AI
- conenct4_ai_no_comments.py is the AI version with no comments in the file
- connect4_ai_commented.py is the AI version with detailed comments on implementation
Requirements:
- python 3 direct download: https://www.python.org/downloads/ detailed isntructions: https://www.youtube.com/watch?v=2nQNsrhaMpA
- numpy: run 'pip install numpy' in the terminal while in any directory
- pygame: run 'pip install pygame' in the terminal while in any directory
Running the game
- Navigate to the root directory of the project in the terminal
- Run the command 'python3 '. For example 'python3 conenct4_ai_no_comments.py'
- frame rate is low on retina screens
- draw implementation is lacking
- Description of minimax algorithm with alpha-beta pruning: https://www.youtube.com/watch?v=l-hh51ncgDI
- Description of minimax algorithm usage in board games: https://www.youtube.com/watch?v=y7AKtWGOPAE