AbraCalc

Four-in-a-Row — Drop Pieces to Connect Four

Drop pieces into a 7-column grid. Connect four of your colour in a row, column or diagonal to win.

Your turn (red). Click a column to drop a piece.
Embed this tool on your site
Cite this tool

APA

AbraCalc. (2026). Four-in-a-Row — Drop Pieces to Connect Four [Online calculator]. Retrieved from https://abracalc.com/game/four-in-a-row/

BibTeX

@misc{abracalc-four-in-a-row, author = {AbraCalc}, title = {Four-in-a-Row — Drop Pieces to Connect Four}, year = {2026}, howpublished = {\url{https://abracalc.com/game/four-in-a-row/}} }

Did this tool answer your question?

How to play

  1. Click any column to drop your red disc — it falls to the lowest empty row.
  2. Connect exactly four of your red discs in a line (horizontal, vertical, or diagonal) to win.
  3. The AI plays yellow and uses a minimax look-ahead to try to beat you.
  4. Block the AI's threats while building your own lines.
  5. Click 'New Game' to reset the board.

Drop red discs into a 6×7 grid. Connect four of your discs in a row (horizontal, vertical, or diagonal) before the AI does. Uses a minimax AI with depth-3 look-ahead.

How it works

Four-in-a-Row (also widely known as Connect Four) is a two-player strategy game played on a vertical 7-column, 6-row grid. Players take turns dropping a coloured disc into any column; the disc falls to the lowest empty row in that column. The first player to connect four of their discs in a horizontal, vertical, or diagonal line wins.

Because discs fall under gravity rather than being placed freely, the game has a strong vertical and diagonal dimension. Building threats in multiple directions simultaneously — so your opponent cannot block everything in one move — is the core strategic skill. Control of the centre column is particularly valuable because it participates in the most potential four-in-a-row lines.

The widget's AI drops discs using a heuristic evaluation, giving casual players a meaningful opponent. It will block obvious threats and create its own, so you need to think at least two moves ahead to beat it consistently.

Four-in-a-Row is a perfect short puzzle for practising strategic thinking, threat counting, and the concept of forcing moves — ideas that transfer to many other strategy games.

Worked example

Create a double-threat the AI cannot block

  1. Drop your first disc into the centre column (column 4).
  2. On your next turns build a diagonal threat rising from the bottom-left while also placing discs horizontally across row 2.
  3. After four or five moves you should have three in a row diagonally AND three in a row horizontally, each needing one more disc in different columns.
  4. The AI can only block one; drop into whichever column it leaves open.

You connect four and win because the AI cannot block two simultaneous winning threats.

Common mistakes to avoid

  • Playing only in response to the AI's threats and never building your own offensive lines — purely reactive play rarely wins.
  • Ignoring diagonal threats: horizontal wins are most visible, but diagonals are harder to spot and the AI often exploits them.
  • Filling a column too early: dropping into a column raises the floor for both players, which can inadvertently set up a winning spot for the AI.

Key terms

Threat
A sequence of three connected discs with an open space that would complete a four-in-a-row; the opponent must block it or lose.
Double threat (fork)
A position where you have two separate threats; since the opponent can block only one per turn, the other wins.
Odd/even threat
An advanced concept where the height (odd or even row) at which a threat can be completed determines which player wins when columns fill up.

Frequently asked questions

How does the AI work?
The AI uses a minimax algorithm with alpha-beta pruning at depth 3, scoring positions based on windows of 4 cells.
Who goes first?
You (red) always go first. Click any column to drop a disc.