- Name: Kelsey Dang Email: [email protected]
- Name: Jayson Doty Email: [email protected]
- Name: Steven Liu Email: [email protected]
- Name: Kelly Kuoch Email: [email protected]
- Constant Declarations
- Functions
- ...
- Scoring System
- Basic AI
- Minimax
- Minimax w/ Alpha-Beta
- ...
- Main
- GUI
- Install the following Python libraries:
- import numpy as np
- import pygame
- import sys
- import math
- import random
- Navigate to the project folder
- To execute the program, run the following command in the terminal:
python connect4-ai.py
- Select one of the four options by typing the corresponding number (1-4):
--- GAME MENU ---
1. Basic AI (R) vs Alpha-Beta (Y)
2. Minimax (R) vs Alpha-Beta (Y)
3. Alpha-Beta (R) vs Alpha-Beta (Y)
4. Player (R) vs Alpha-Beta (Y)
Select an option (1-4):
- The Pygame window should open up. If the window is running in the background, simply click on the Pygame window from your computer desktop taskbar to bring it forward.
The 4 options:
- Option 1: Basic AI (Red) vs Alpha-Beta (Yellow)
- User simply spectates the basic AI (non-Minimax) play against Minimax w/ Alpha-Beta
- Option 2: Minimax (Red) vs Alpha-Beta (Yellow)
- User simply spectates the Minimax algorithm play against Minimax w/ Alpha-Beta
- Option 3: Alpha-Beta (Red) vs Alpha-Beta (Yellow)
- User simply spectates Minimax w/ Alpha-Beta play against itself
- Option 4: Player (Red) vs Alpha-Beta (Yellow)
- User plays against Minimax w/ Alpha-Beta
The experiment folder contains any files that can be used for experimenting or testing the code.
- function.py
- Ignore this file, it does not contribute to the final code
- test.py
- File to test and experiment with the Connect Four game from the YouTube tutorial by Keith Galli
- test2.py
- File to test and experiment with the Connect Four code from codeNewb204's Github repository
The project folder contains the source code of our Connect Four AI.
- connect4.py
- Starting code of the Connect Four game followed by a YouTube tutorial by Keith Galli
- connect4-terminal.py
- Starting code of terminal Connect Four from codeNewb204's Github repository, ignore this file since it does not contribute to the final code
- connect4-ai.py
- The final source code that we worked on, contains modified minimax alpha-beta implementation from the YouTube tutorial by Keith Galli
- YouTube Connect 4 /w Minimax Tutorial: https://www.youtube.com/watch?v=MMLtza3CZFM&t=2810s
- YouTube Connect Four with Minimax Alpha-Beta Pruning Code Github Repository (Starting Code): https://github.com/KeithGalli/Connect4-Python/blob/master/connect4_with_ai.py
- Existing Terminal Connect Four Code Github Repository: https://github.com/codeNewb204/Terminal-Game/blob/main/Connect4.py