Back to projects

The Ultimate Connect 4 Bot

A cloud-deployed Connect 4 AI featuring dual neural network architectures (CNN and Transformer), trained on MCTS expert gameplay data and served through a real-time web interface for interactive human-vs-bot play.

pythonawsdockermachine learningCNNtransformeranvilclaude code
View Live Project
Screenshot of The Ultimate Connect 4 Bot

This project simulated Connect 4 board positions using Monte Carlo Tree Search (MCTS) to generate expert-level gameplay data. From there, we built and trained both CNN and Transformer models on these board positions to create a strong AI opponent for users to play against.

The models achieve 89% top-3 move accuracy, meaning the bot consistently selects from the strongest possible moves in any given board state. Players can choose which model architecture to compete against through the web interface.

On the infrastructure side, the trained models are connected to a backend deployed on AWS Lightsail using Docker containers. The frontend was built using the Anvil web platform with custom CSS to polish the user experience. Claude Code was used extensively for CSS creation and refinement throughout the project.