Connect 4 AI

Ohio Wesleyan University — Fall 2022

A Java implementation of Connect 4 supporting both two-player and single-player (vs. AI) modes, built as a final project for an Ohio Wesleyan University course with collaborators Alex Casper and Jose Mancilla. The AI opponent uses alpha-beta pruning, an optimization of the minimax search algorithm that prunes branches of the game tree that cannot affect the final decision, allowing it to look further ahead without exploring the full tree. A browser-playable version is available via the live demo below.

Game logic and the core implementation were led by Aadarsha Gopala Reddy, the AI opponent by Alex Casper, with extensive testing and debugging of the alpha-beta search by Jose Mancilla.

Highlights

  • Full Connect 4 rules with win/draw detection in Java
  • AI opponent using alpha-beta pruning (minimax-based search)
  • Single-player (vs. AI) and two-player modes, with choice of who moves first
  • Browser-playable demo alongside the Java implementation

Technologies Applied

JavaHTMLCSSJavaScriptOOPArtificial IntelligenceGit