Accessible Connect 4 AI

Bringing Connect 4 to players with visual or mobility impairments

Problem Description

At face value, Connect 4 is a very simple game. Players take turns placing pieces into columns, with the first player to make 4 in a row horizontally, vertically, or diagonally winning. However, with over 4.5 trillion board states, this game allows for complex strategies to force your opponent into a losing position. This makes Connect 4 ideal for players of all ages.

Unfortunately, Connect 4 is not accessible to all. Individuals who are blind or have difficulty moving the pieces may find it challenging to play with either the physical board or existing online versions. We’ve developed a program to let such players play Connect 4 without touching or seeing the board.

Implementation, Challenges, and Decisions

Our solution came in two major parts: a reinforcement learning model and an accessible UI. Each posed its own challenges.

  • DQN Model Training: Initial single-model DQN struggled to surpass basic play. Splitting into two models improved vertical threat blocking but horizontal and diagonal defense lagged. We tweaked rewards, epsilon decay, network depth, and replay buffer design—within our compute limits. One original model attempted to use a dataset to learn good board positions from. This dataset can be found here: Data Set
  • Hybrid Approaches: Unfortunately, many of our original approaches failed to get past extremely basic strategy. We attempted other more complex approaches to try to solve this problem. This first was an AlphaZero-style approach which used a Monte Carlo Simulaiton to look into future moves, however, this was too computationally heavy. We also attempted a DQN with hard-coded moves to block threats and make winning moves, while this performed better it seemed against the spirit of machine learning, Finally we used calls to “perfect” solved-game API which is able to evaluate every move in order to give a better reward function. The final model that we have utilizes this API.
  • Accessible UI: Designed to accept voice commands for column selection and a “read board” command. Prototyped via local Jupyter/VS Code (Colab’s audio APIs are limited), using prerecorded audio.

Final Model Results:

When developing our model we evaluated based on metrics that we graphed and playing against the model. Here are the results from Our final Model.

Screenshots:
Screenshot 1 Screenshot 2 Screenshot 3
Demo Video:

Future Considerations

Perfect Play: A Mini-Max or full MCTS implementation could guarantee optimal moves. Would then require some system for allowing different difficulty of levels.

Enhanced UI: Integrate a live speech-to-text / text-to-speech engine for real-time voice interaction, should be able to work on all systems. This may require a separate application to be able to run well.

Game Expansion: Expand the creation of systems such as these to other games to improve accessibility across the hobby gaming space.

Resources: Documents & Videos

Github Repository:

Leads to repository with full code and branches containing some past designs (branches not organized):

Connect 4 Reinforcement Repository
Self Sustained Notebook:

Click the link below to download the complete project folder, including the Jupyter notebook and trained weights:

📦 Download Project Notebook and Trained Weights
Executive Report:
Project Explanation Video: