3D / 4D Four-in-a-Row

Configure your match, then start fullscreen gameplay.

3D: one N×N×N board — 13 win directions.
How to Play

Goal: Be the first to place 4 stones in a row — in any direction across the 3D (or 4D) board.

Winning lines

Any straight line of 4 counts: the 3 axis-aligned directions (rows, columns, verticals), 6 face diagonals, and 4 space diagonals — 13 directions total. In 4D mode this extends across the fourth dimension too.

Visual mode

The board is shown as stacked 2D layers in 3D perspective. Click any empty cell to place your stone. Drag to rotate the view; scroll or pinch to zoom.

Blind Coordinates mode

The board is hidden. Type coordinates as x,y,z (1-based) and press Place. Good for a mental challenge.

Gravity mode

You only pick an (x,y) column — your stone drops to the lowest empty z level, like Connect Four. Cannot be changed mid-game.

Board size

Choose 4–6. A size-4 board has 64 cells and plays fast; size-6 has 216 cells and is much harder.

vs AI

The AI uses minimax with alpha-beta pruning. It plays as Player 2 (O).