Four in a row vs a real search engine
Your turn — drop a disc
0
Wins
0
Losses
0
Draws

Connect 4 Online vs Computer

Play the classic Connect 4 (Connect Four, four-in-a-row) directly against the computer — free, in your browser, with no download and no sign-up. Drop red discs into the blue 7×6 board and line up four before the AI does. This is a single-player game built around an honest AI opponent: Beginner deliberately makes mistakes you can punish, Medium plays a solid tactical game, and Hard runs an extremely strong search engine that thinks about a second per move. You can choose who goes first, undo your last exchange, and your wins, losses and draws are tracked per difficulty in your browser.

How the AI thinks

The opponent here is not a set of canned tricks — it is a real game-tree search engine, the same family of algorithm used by classic chess programs. The board is stored as bitboards: each player's discs live in a single 64-bit number, so testing "is there a four in a row?" takes just a handful of bit operations. On top of that the engine runs negamax with alpha-beta pruning: it plays out possible futures for both sides, scores the outcomes, and picks the move with the best guaranteed result, skipping branches that provably cannot matter. A transposition table remembers positions reached by different move orders so they are only analysed once, and iterative deepening lets Hard search as deep as its time budget allows — in our measurements, depth 15 in the opening and 19 or more in the midgame, examining on the order of a million positions per move. The whole engine runs locally in your browser (in a background worker thread, so the page stays responsive), and nothing is sent to a server.

One honest note: Connect 4 is a solved game — with perfect play from both sides, the first player wins by starting in the center column. Our Hard engine is extremely strong against human play, but we don't claim it is perfect. That's also your way in: see the tips below.

How to play Connect 4 — the rules

Tips to beat the AI

FAQ

Can I play Connect 4 online against the computer?
Yes — that is exactly what this page is. Pick a difficulty, choose who moves first, and play. Works on desktop and mobile, free, with no account.

How strong is the AI?
Beginner deliberately plays some random moves. Medium always takes an immediate win and blocks yours. Hard searches roughly 15–19 moves deep with about a second of thinking per move — extremely strong, though we don't claim perfection.

Can I go first?
Yes, and it matters: Connect 4 is solved, and with perfect play the first player wins. Letting the AI start makes every level harder.

Is there a two-player mode?
No — like every game on the LK Forge games hub, this one is deliberately built around playing against a real AI.

Is it free? Does it work offline?
Completely free, no download, no sign-up. The engine runs client-side, so once loaded the game keeps working without a connection. More AI games: AI Chess, AI Checkers, AI Othello, AI Tic Tac Toe or AI Minesweeper.

More AI games on LK Forge