Connect Four
Classic 7×6 Connect Four — play a friend or a tunable minimax engine
Connect Four
You to playClick a column, or focus the board and use ← / → then Enter to drop. Esc opens the new-game prompt.
Game details
0 discs playedMove history
No moves yet. Click a column or use the arrow keys.
Scores
| Depth 4 | Wins | Losses | Draws |
|---|---|---|---|
| You vs AI | 0 | 0 | 0 |
New game. You move first.
Examples
Play the computer
Choose vs Computer and depth 4, click a column and watch the node counter climb between search depths before the AI replies.
Hot-seat match
Switch to Two players, take turns dropping discs and use Undo if you want to retry a single move.
Study the engine
Compare the search log at depth 1 and depth 8: deeper moves inspect more nodes and prefer wins that arrive sooner.
About this game
Drop discs into a 7×6 grid and connect four horizontally, vertically or diagonally. Play hot-seat with a friend, or face a deterministic minimax engine whose depth you can tune from 1 to 8.
The computer checks for an immediate win, blocks an immediate threat, then searches with alpha-beta pruning, center-out move ordering and a transposition table. Each completed search depth updates the live node counter and nodes-per-second readout, so you can watch the engine think rather than waiting on an opaque move. Deeper presets see more plies but take longer; a wall-clock budget keeps even depth 8 responsive. The per-move log records the column, depth, nodes and milliseconds for every computer reply.
Undo steps back one move in hot-seat mode or a full player/computer pair against the AI. Winning lines are highlighted, full columns shake instead of accepting a disc, and a full board with no four-in-a-row is a draw. Scores are tallied per depth in computer mode and per player in hot-seat mode, and are stored only in this browser.
The board is fully keyboard playable: focus it, move the selected column with the left and right arrow keys, press Enter to drop and Escape to start a new game. Amber solid-centre discs and blue striped discs remain distinguishable without relying on colour, and reduced-motion preferences disable the drop animation.
What this game does not do
- Processes only the inputs provided in this session without connecting to external accounts or background servers.
- Runs entirely in the current browser tab; nothing is synced across devices or backed up to a server.
How to use this game
Select opponent and AI depth
Choose AI difficulty (search depth) or two-player pass-and-play.
Drop discs into columns
Click or use number keys 1–7 to drop discs and race to connect four.
Inspect search stats or undo
View evaluated nodes/scores per AI turn or undo moves to explore lines.
Use cases
Play the computer
Choose vs Computer and depth 4, click a column and watch the node counter climb between search depths before the AI replies.
Hot-seat match
Switch to Two players, take turns dropping discs and use Undo if you want to retry a single move.
Study the engine
Compare the search log at depth 1 and depth 8: deeper moves inspect more nodes and prefer wins that arrive sooner.
Common mistakes
Mistake:What does search depth change?
Fix:Higher depth lets the minimax solver look more plies ahead to spot forced traps and double threats, trading a few extra milliseconds of browser compute for stronger play.
Mistake:Can two people play locally on the same screen?
Fix:Yes. Switch between Player vs AI and local two-player pass-and-play mode, with full move undo and win-line highlighting.
Frequently asked questions
How does the Connect Four AI choose moves?
It runs deterministic minimax search with alpha-beta pruning, center-column move ordering, and 4-in-a-row window heuristics—no cloud calls or neural networks.
What does search depth change?
Higher depth lets the minimax solver look more plies ahead to spot forced traps and double threats, trading a few extra milliseconds of browser compute for stronger play.
Can two people play locally on the same screen?
Yes. Switch between Player vs AI and local two-player pass-and-play mode, with full move undo and win-line highlighting.
Are game stats uploaded anywhere?
No. Match state and win counters live locally in your browser.
Related tools
2048
Classic 2048 tile puzzle — swipe or use arrow keys to merge equal tiles and reach 2048. Auto-save and best score stay in your browser.
Aim Trainer
Free browser aim trainer with grid and flick modes, shrinking targets and local scores.
Brick Breaker
Classic paddle-and-ball brick breaker on canvas — five levels, power-ups, mouse or keyboard control, and a best score saved in your browser.
Maze Runner
Play a procedurally generated maze race with four growing levels, keyboard and touch controls, and best times saved locally.
Memory Match
Classic memory pairs game — flip two cards at a time, match all pairs and beat your best moves and time. Three grid sizes, three themes, zero downloads.
Minesweeper
Classic Minesweeper — clear the field without detonating a mine. Three difficulties, flag mode for touch, guaranteed-safe first click, best times saved locally.