About this tool
Drop discs and line up four in a row before the AI does — free online strategy board game.
Four in a Row is a browser version of the classic 7-column by 6-row disc-drop game, where discs fall to the lowest empty cell and the first player to line up four horizontally, vertically or diagonally wins. The computer opponent runs a minimax search with alpha-beta pruning at a depth you choose — 2 plies on Easy, 4 on Medium and 6 on Hard — and prefers the centre column when scores tie. There is also a pass-and-play mode for two people on the same screen, with a win/loss tally and a best-streak counter.
Open Four in a Row on AltFTool — it loads instantly in your browser.
Add your input to the workspace.
Adjust the options until the result looks right.
Copy or download the output and put it to work.
Difficulty changes the actual search depth (2, 4 or 6 plies) rather than making the AI drop moves at random.
The evaluation scores every four-cell window on the board and weights a live three-in-a-row of yours above one of its own, so it blocks rather than races.
Completed fours are highlighted on the board, and consecutive wins against the AI are recorded as a personal best streak.
The board is 7 columns by 6 rows, 42 cells in total, and you win by connecting four of your discs in a row horizontally, vertically or diagonally. Discs drop to the lowest empty cell in the column you pick, so you only ever choose a column, never a square.
Easy searches 2 plies ahead, Medium 4 and Hard 6. At 6 plies the engine will reliably spot and block a three-in-a-row and set up its own double threats, so Hard is a real opponent rather than a token one.
Yes — switch from the AI mode to pass-and-play and the two colours alternate on one board with no computer opponent involved. The running tally shows results for both players.
The centre column sits in more possible winning lines than any other, so the evaluation adds a bonus for every disc there and the search tries centre columns first. That ordering also makes alpha-beta pruning cut more branches, which is why Hard stays responsive at 6 plies.