Four in a Row
Play Four in a Row free in your browser. Drop discs on a 7 × 6 board against the computer (easy, medium, hard) or a friend, with keyboard controls.
- Red wins
- 0
- Yellow wins
- 0
- Draws
- 0
- Fastest win
- –
Click or tap a column to drop a disc. Keyboard: Left and Right arrows to choose a column, Enter or Space to drop, keys 1 to 7 to drop directly, N for a new game.
How to play
- Choose a Mode: Against the computer or Two players on the same device.
- Against the computer, set the Difficulty (Easy, Medium or Hard) and choose what You play: Red (you start) or Yellow (computer starts).
- Click or tap a column to drop a disc. It falls to the lowest free space in that column.
- Players take turns. The first to line up four discs of their colour, horizontally, vertically or diagonally, wins. The winning four are ringed on the board.
- If all 42 spaces fill up without a line of four, the game is a draw. Press New game (or N) to play again.
The tally under the board counts Red wins, Yellow wins and Draws in this browser, and Fastest win keeps your best result against the computer at the selected difficulty: the fewest discs you needed to win. Reset score clears the tally.
Keyboard controls
The seven columns form one row of buttons. Press Tab to reach the board, choose a column with the Left and Right arrow keys (Home and End jump to the edges), then press Enter or Space to drop your disc. The keys 1 to 7 drop a disc straight into columns 1 to 7. Each column tells screen readers how many spaces are free and which discs it holds, from the bottom up.
How the computer thinks
The computer uses a classic game-tree search called minimax with alpha-beta pruning. It imagines its possible moves, your best replies, its answers to those, and so on, up to a fixed number of moves ahead (called plies). Positions at the end of that horizon are scored with a heuristic: open lines of three and two, and discs in the centre column, count in favour of whoever owns them. Alpha-beta pruning skips branches that cannot change the decision, and trying the centre columns first makes that pruning much more effective.
- Easy looks 2 moves ahead and, one time in three, plays a random column instead.
- Medium looks 4 moves ahead: it never misses an immediate win or an obvious block.
- Hard looks 8 moves ahead and spots most traps several moves before they close.
The search runs in small slices of a few milliseconds, so the page stays responsive while the computer thinks, even on a slow phone.
Strategy tips
- Play the centre. The middle column is part of more possible lines of four than any other column. Opening there is the strongest first move.
- Look for double threats. Like a fork in other games, a move that creates two separate ways to win cannot be fully blocked.
- Watch the space below a threat. A three-in-a-row with an empty space above a gap is only dangerous when the space under it fills. Avoid filling the square that lets your opponent complete a line.
- Think in rows. The first player tends to benefit from threats on odd rows (counting from the bottom), the second player from threats on even rows. Late in the game, this “zugzwang” often decides who is forced to play into the other’s trap.
- Block early. Two discs with open space on both sides can quickly become an unstoppable threat.
Frequently asked questions
Can the computer be beaten on Hard?
Yes, but it takes care. Hard sees eight moves ahead, so you need threats that only pay off beyond that horizon, usually by building a threat on the right row and waiting until the board fills.
Does the first player have an advantage?
Yes. With perfect play the first player can always force a win on a 7 × 6 board by starting in the centre column. Humans and search depths of eight moves are far from perfect, so games stay open.
Why does the computer sometimes take a moment?
On Hard it examines many thousands of positions. It does this in short chunks and adds a small pause so you can see its move land. The page never freezes while it thinks.
Is my score saved?
The tally and your fastest wins are saved in your browser’s local storage on this device only. No account and no server are involved.
Can I play with a friend on one screen?
Yes. Choose Two players and take turns on the same computer, tablet or phone. The status line above the board shows whose turn it is.
Related tools
- Tic-Tac-Toe Play free tic-tac-toe in your browser against the computer (easy, medium or unbeatable hard) or with a friend on the same device, with a running score.
- Memory Match Play a free memory matching game in your browser. Four grid sizes, emoji or shape cards, moves and time tracking, best scores and a 2-player mode.
- Minesweeper Play classic Minesweeper free in your browser. Safe first click, three board sizes, flags by right-click or long-press, chording and keyboard controls.
- Solitaire (Klondike) Play free Klondike solitaire in your browser. Draw 1 or draw 3, drag and drop or click to move, unlimited undo and auto-complete, on desktop and mobile.