How to win at Connect Four every time! A link to a game solver that you can use on your smartphone or computer – Mind Your Decisions
I have written over 300 posts on game theory, and most of the articles are about how game theory can be used to solve problems in business, politics, or real life; in other words, about anything other than games. Of course, game theory can also be used to analyze real games, and today’s example is about winning strategy in a popular board game.
connect four is a board game for two players similar to tic-tac-toe. each player takes turns dropping a colored disc on a board that has 7 vertical columns and 6 horizontal rows. The objective of the game is to connect four pieces of the same color, vertically, horizontally, or diagonally, before the other player does. the game ends in a tie if neither player connects four when all 42 board positions are filled.
While the rules are simple, the game is surprisingly difficult to analyze. even a simple question like “is there a winning strategy?” it becomes a complicated task. Strategies like “play in the middle” and “make sure to block your opponent” will only get a player so far, and occasionally these strategies will lose. Trying to work out a winning strategy by trial and error would prove to be an insurmountable task, as there are over 70 trillion possible match-four games.
luckily for us, some people have solved the game with computers and found the winning strategy. There’s even a game solver that makes winning the game as easy as following the instructions on your smartphone.
update 11-2016 I’ve been told that the resolver linked in this post doesn’t work. a commenter suggested the following website: connect 4 solver (http://connect4.gamesolver.org/)
. .
“everything will be fine if you use your mind for your decisions and only care about your decisions.” Since 2007, I have dedicated my life to sharing the joy of game theory and mathematics. mindyourdecisions now has over 1,000 free articles with no ads thanks to community support! support and get early access to posts with a patreon pledge.
the first connect four solutions
here is a bit of history on how the game was solved.
Solving the game is no small feat, and surprisingly, two people in 1988 independently came up with the answer. james d. Allen and Victor Allis discovered that the first player has a winning strategy for the game. that’s the good news. the bad news is that the winning strategy is extremely complicated to describe. there are so many board configurations to consider. Also, one has to play very carefully because in many situations there is only one winning move, and every other move will be a losing move, allowing the second player to force a win.
However, understanding the winning strategies described is no easy task. Allen’s explanation involves many new terms such as aji, sente, and tenuki. Allis’ article similarly employs the obscure vocabulary of threats, useless threats, reverse base, and zugzwang. To gain an appreciation of complex strategy, just read one of the following documents: (Allen) Expert Play in Connect Four or (Allis) A Knowledge-Based Approach to Connect-Four.
Although a winning strategy has been described since 1988, there was no easy way for a casual fan to use the knowledge. now there is.
a game solver that you can use from your smartphone!
This useful solver is the result of research by dan garcia, professor of computer science at berkeley.
here is the url:
http://cloud.cs.berkeley.edu:8090/gcweb/ui/game.jsp?game=connect4
update 11-2016 I’ve been told that the resolver linked in this post doesn’t work. a commenter suggested the following website: connect 4 solver (http://connect4.gamesolver.org/)
These are the steps to use the solver.
1. To solve the classic game, go with the default option (having 7 columns and 6 rows and 4 in a row wins). you can change the options if you are playing on a different board.
2. click “play!” and you will see the board.
3. very important: you want to click the check mark for “move values” under the “display options” header. this option will display colors in each column. a green color indicates a winning move (this is where you should play), yellow indicates a tie, and red a losing move.
4. be the first person to move. Enter your moves and your opponent’s moves and keep playing winning moves. you will always win!
here is an example of the steps. the board was chosen to be 7×6 with 4 in a row winning. I’ve selected the “move values” checkmark and I’m ready to play first.
This is what the dashboard looks like.
It turns out that the only winning move is to play in the middle. I do this.
Now it’s the other player’s turn. the game solver illustrates that every move is a loss, no matter where the other player goes.
suppose the other person plays directly up in the center.
what to do now? the important thing is to follow the solver of the game. in this setup, there is only one good move to play – all other moves will be losers (i.e. allow the other player to win the game with proper play).
with perfect play from both sides, many games will take 41 (in other words, the 42-place board will almost fill). I won’t give you more details on how to complete a game, but you will get an idea of how the solver works.
If you diligently follow the steps in this tool, you can always win at connect four! it’s as easy as that.
now the real trick will be to find a way to use the solver without the other person noticing. Finding a good excuse to keep checking your phone (are you getting a lot of text messages?) will be the real test of a good strategist.
update 11-2016 I’ve been told that the resolver linked in this post doesn’t work. a commenter suggested the following website: connect 4 solver (http://connect4.gamesolver.org/)