Whether it be Grad Nite, End-of-Year Parties, or College Orientation, the party game classic Connect Four is always there. And every time, I trusted my quick thinking and logic skills to bring me to a Connect Four victory. (Needless to say, I lost every time.) But this hackathon was my chance at redemption; I would finally defeat my nemesis. Using Neural Networks, Convolutions, and Genetic Algorithms, I finally have beaten the game that has tormented me for so many weeks!

What it does

I wrote and trained a neural network to play Connect Four.

How we built it

Uses a self-made convolutional neural network, trained by a genetic algorithm. Essentially, in each generation, the bot is pitted against a mutated (changed) version of itself, and scored on its performance. The low performing bots are discarded and the highest performing AIs repopulate and mutate the next generation.

This is also a full-stack project where the AI is run on a server and communicates that info to the front-end via post requests.

Challenges we ran into

Training and figuring out how to optimize the model has been difficult.

Accomplishments that we're proud of

I’ve studied and read about them before, but this was my first time making a convolutional neural network!

What we learned

Every machine learning problem has many nuances and facets to take into account in order for training to go smoothly. I also gained a bit more valuable experience with backend server communication.

What's next for Connect Four AI

I might explore by altering the fitness functions to guide training in a less haphazard way.

Share this project: