Four in a Row Game Online - Play vs AI
Drop discs to connect four in a row before your opponent. Play against a smart AI or challenge a friend on the same device.
Runs in your browser. No data leaves your device.
Frequently Asked Questions
How do I play Four in a Row?
The CPU uses a depth-6 minimax algorithm with alpha-beta pruning on a 6x7 grid. The heuristic evaluates every possible 4-cell window horizontally, vertically, and diagonally, scoring threats and blocks from both sides, with a bonus for controlling the center column. Move ordering sorts candidate columns by distance to center to maximize pruning efficiency.
Can I play against another person?
Yes. Switch to two-player mode and take turns dropping discs on the same device. The game tracks whose turn it is and detects wins automatically.
How smart is the AI?
The AI uses a minimax algorithm to evaluate moves and can be quite challenging. It looks ahead several moves to block your winning combinations while building its own.
What are winning strategies?
Control the center column, build multiple threats simultaneously, and try to create a setup where you can win in two directions at once. Forcing your opponent to block one threat while you complete another is the key to winning.