Ronan Hevenor, Diane Baek, Colton Perry
11 December 2025
Connect 4, a tabletop game developed by Howard Wexler, involves two players dropping chips or tokens on top of each other into a six by seven grid. The main objective of the game is to be the first player to get four chips in a row.
Though the rules are simple, devising strategies to guarantee a win isn't as straightforward as one might expect. Humans aren't perfect, which means that playing Connect 4 without giving your opponent an advantage would be relatively difficult.
Is it possible to create an algorithm or neural network that can perfectly play Connect 4 every round? Would this program be superior to human players?
The common reason for choosing this project is because the advancement and creation of neural networks and algorithms is interesting to us. Therefore, we wanted to develop our own program that could answer the aforementioned questions.
These questions relate directly to material we discussed in class regarding machine cognition and what it means for a system to exhibit rational behavior.
Because there are so many approaches to developing a Connect-4 solving program, we considered the following questions:
Since each chip position in the Connect-4 grid could be represented in a 2D array, we initially decided to develop a neural network. Each column is represented by an integer (indexed from zero), and the neural network would "pick" where it would drop its chip.
Because the output is a single integer, a neural network that is properly trained would make decisions faster than an algorithm that would calculate every possible position. Due to this, it seemed more probable to take the neural network approach, though we didn't want to entirely disregard utilizing trees or search tables that could aid our neural network.
We used a genetic algorithm to attempt to determine the optimal parameters. We paired the randomly generated algorithm with a perfect AI, and simulated slight shifts after every game. Our hope was to generate an algorithm which could approximately reproduce the "solved" game.
Unfortunately, there was a slight oversight in how the AI was evaluated. Since only a perfect AI can beat the perfect AI, the neural network never improved, because it lost every game. The only way that the AI would have become perfect is if it were randomly generated, the odds of which are near zero.
For this algorithm, we dynamically generate a tree of all possible moves after the current board state, and analyze the percentage of each tree that leads to a win versus the percentage that leads to a loss.
Since there are way too many possible permutations of the Connect 4 board (in the trillions), we have to pick and choose which tree branches will end in failure early and "prune" those branches—that is, stop simulating down that path and prioritize others.
For this method, we used a public dataset from Hugging Face, compiled using Pascal Pons's Connect 4 solver. This dataset has roughly 160 million game board states from all levels of the game, as well as the win probability of both player X and player O (and draws) at each of those states.
This approach uses a sample-based method, where the idea was to have the AI try to predict the results of the samples, and then extend it to the whole game.
Our process of cherry-picking the best playing AI mimics real-life evolution and fitness. In a way, we "breed" the ultimate AI by choosing the best children—like how dog breeders choose dogs with the most desirable traits and breed other dogs with similar traits to eventually end up with the best possible dog.
The final iteration of our program is able to play Connect 4. Albeit not perfect, on average, it is able to play better than humans.
Its flaws are evident when playing against perfectly playing AIs, because all of them lost against a perfect player.
Our final minimax algorithm is a significantly better player than our neural network program, and it wins every time against the neural network. This is because the neural network is at its core a statistical algorithm, whereas the minimax finds the near mathematically optimal solution.
Our self-learning approach never fruited a working algorithm.
From this project, we learned that the best method for making a program (in a short amount of time) to successfully play Connect 4 is to use a tree-searching algorithm like minimax.
We also learned that our AI can "think," since it can translate human input into symbols and process information about a game state. It is, up to a certain extent, "logical" or "reasonable" since, using given information, it could develop a strategy to win—it has a given goal and can fulfill it.
Our program satisfies the criteria of being able to play Connect 4, though it didn't prove to be satisfactory in winning the final competition.
The philosophical implications of this project are significant.
The thing we made isn't able to make itself. We're not making something that has the skills we used while making it. Ethically, this seems better if used only as a tool for menial tasks.
The learning approach, unlike the tree-algorithm approach, allows the AI to learn from itself, rather than following a set of mathematical pre-written instructions. This gives our AI autonomy and independence, rather than just acting like a robot.
Another difference is that our process of cherry-picking the best playing AI mimics real-life evolution and fitness. In a way, we "breed" the ultimate AI by choosing the best children—like how dog breeders choose dogs with the most desirable traits and breed other dogs with similar traits to eventually end up with the best possible dog.
In its current state, we've proved that humans can create something that is capable of beating us; so, we are sort of better at making Connect 4 AI than we are at Connect 4.
In conclusion, while our program did not satisfy our goals because we didn't win the competition, the project provided valuable insights into the challenges of creating game-playing AI.