Games

Four in a Row

Connect four in a row first — vs AI or two players.

Your turn (Red) Moves: 0

What is this?

Four in a Row is played on a 7×6 board where two players alternate dropping discs into columns. The first to line up 4 discs in a row — horizontally, vertically, or diagonally — wins. Use the Mode control to play vs AI (against the computer) or 2 players (two people taking turns on one device).

How to play

Click any column to drop a disc into its lowest empty cell. In vs AI you play Red and the computer replies with Yellow automatically; in 2 players both people alternate placing Red and Yellow. The game ends the moment either side completes 4 in a row. Use Undo to take back the last move (two discs vs AI, one in 2 players), or New game to restart. Changing the mode starts a new game.

How does the computer AI play?

The computer uses minimax search with alpha-beta pruning to look several moves ahead and pick the strongest column. Higher difficulty searches deeper for sharper play. It immediately blocks the opponent's winning move and prioritizes completing its own.

Privacy

Game progress is shown only in your browser and is never sent to or stored on a server.

What are the rules of Four in a Row?
The first player to line up 4 discs in a row — horizontally, vertically, or diagonally — wins, dropping discs into the lowest empty cell of any column. In vs AI you play Red first and the computer plays Yellow; in 2 players, two people alternate on one device.
How do I switch between vs AI and 2 players?
Use the 'Mode' control above the board to pick vs AI (against the computer) or 2 players (two people on one device). Changing the mode starts a new game. Difficulty (Easy·Normal·Hard) applies only in vs AI.
How many times can I undo?
Undo takes back the last move (two discs in vs AI, one in 2 players). There is no limit — use it as often as you like during a game.
How strong is the computer?
It's a minimax search AI with alpha-beta pruning; higher difficulty searches deeper for sharper play. It immediately blocks the opponent's winning move and prioritizes completing its own.
Is any data stored on a server?
No. The entire game runs only in your browser and no data is ever sent to a server.