3D Tic Tac Toe

Noughts and crosses played through a stack of boards rather than one, so a line can run upwards or diagonally through the cube. There are seventy-six ways to make one, and watching all of them is the difficulty.

How to play

Four layers sit side by side on screen and together they are a four by four by four cube, so a winning line often runs across the screen from one layer to the next rather than sitting inside one square.

  1. Read the layers Layer one is the top of the cube and layer four the bottom. The same square on all four layers is a vertical line.
  2. Tap an empty cell Any empty cell on any layer, in any order. There is no gravity here.
  3. Look for diagonals through layers A line can start at one corner of layer one and finish at the opposite corner of layer four. Those are the lines people miss.
Full instructions

In depth

Finding four in a row inside a cube with seventy-six lines

How the four-by-four-by-four board works, where the seventy-six winning lines come from, why certain cells are worth far more than others, and the specific habits that let you see threats the computer cannot hide.

Screenshot: How to play 3D Tic Tac Toe
How to play 3D Tic Tac Toe as it appears when the page opens.

The board and the goal

The board is a four-by-four-by-four cube. Because showing a cube on a flat screen is awkward, the game lays it out as four flat grids side by side. Each grid is one horizontal layer of the cube. Layer one is the top and layer four is the bottom.

You and the computer take turns placing a marker in any empty cell on any layer. There is no gravity here. You can place on any layer in any order. The first player to get four of their marks in a straight line wins. That line can run along a row, up a column, straight down through the layers, or diagonally across a face or through the whole cube.

Where the seventy-six lines come from

Sixteen lines run along each of the three axes: rows, columns, and verticals. That gives forty-eight axis-aligned lines. Each of the three ways to slice the cube into flat four-by-four squares produces four squares, each with two diagonals, adding twenty-four face diagonals. Four more lines run corner to corner through the solid body of the cube. The total is seventy-six.

These lines are not listed by hand. The game generates them by walking every possible direction from every cell and keeping only the lines that stay inside the cube. It then counts how many lines pass through each cell. That count drives the computer's decisions.

The sixteen cells that matter most

Not every cell is equal. The eight corners of the cube each sit on seven lines. The eight cells forming the two-by-two-by-two core in the centre of the cube also each sit on seven lines. Every one of the other forty-eight cells sits on only four lines.

Seven lines versus four is a large difference. A marker on a seven-line cell joins almost twice as many potential winning lines as a marker on a four-line cell. In the opening, these sixteen cells are the most valuable targets. Taking a corner or a centre-core cell early puts you in a position to build threats in many directions at once.

Controls and the scoreboard

Tap or click any empty cell on any layer to place your marker. The computer replies after a brief pause. A message below the board tells you whose turn it is and warns you when the computer is building threats. When the game ends, the four cells forming the winning line are highlighted.

The stat bar shows three numbers. Your threats counts how many lines you have with three of your markers and one empty cell. Their threats counts the same for the computer. Moves shows how many placements have been made in total. Keeping an eye on the threat counters is the fastest way to read the state of the game.

The three computer levels

The Computer dropdown offers Gentle, Normal and Sharp. All three levels will take an immediate win and block an immediate loss. The difference is what they do when no win or block is available.

Gentle picks from the most promising cells with some randomness mixed in. It knows which cells sit on the most lines but does not search ahead. Normal looks for moves that create two threats at once and blocks moves that would let you do the same. Sharp does all of that and also searches several moves ahead through the strongest candidates, choosing the line that gives it the best evaluated position.

Even on Gentle the computer will not hand you free wins. It always prioritises high-value cells and blocks obvious threats. The gap between Gentle and Sharp shows up in the middle game, where Sharp spots multi-move combinations that Gentle misses.

The fork: making two threats at once

The single most important tactic in this game is the fork. A fork is a move that creates two separate lines, each with three of your markers and one empty cell. Your opponent can block one of them, but not both. On the next turn, the unblocked line completes.

Because there are seventy-six lines and many of them cross at the same cell, forks are far easier to build here than on a standard three-by-three board. A single marker placed on a seven-line cell can extend two different lines simultaneously. The whole middle game revolves around who builds a fork first.

When you have two markers in a line, check whether the third cell you need also extends a different line. If it does, placing there may create a fork on the following turn. This two-step thinking is what separates winning from drawing.

Blocking forks before they form

It is not enough to block threats one at a time. If the computer has two threats, blocking one still loses. You needed to prevent the move that created both threats, which happened a turn earlier.

Before each move, count the computer's current threats. If the count is zero, you have time to build. If it is one, you must block. If it is two, the game is already decided in its favour unless one of the two threats shares a cell, letting you block both with one placement. Get into the habit of scanning the threat counter before you plan your own attack.

Vertical and diagonal lines that people miss

The most overlooked lines are the verticals. A vertical line passes through the same position on all four layers. Because the layers are shown side by side, not stacked, your eye does not naturally trace vertical lines. Before every move, scan the same square across all four grids. If the computer holds three of those four cells, you must block immediately.

The four space diagonals are also easy to forget. A space diagonal starts at a corner of layer one and ends at the opposite corner of layer four, passing through the middle of layers two and three. These lines cross at the centre-core cells, which is another reason those cells are so valuable. A marker in the centre core sits on a space diagonal, making it part of a line most players do not watch.

Opening moves and first-player advantage

With perfect play, the first player can always force a win. You go first, so the advantage is yours. Use it by taking a high-value cell on your first move. A corner or a centre-core cell gives you seven lines to work with from the start.

A common strong opening is to take a corner on layer one, then a centre-core cell on the next move if it is still open. This sets up two building paths immediately. If the computer takes a centre-core cell first, consider taking the opposite corner on the same layer to keep pressure balanced across the board.

Common mistakes that cost the game

  • Playing only on one layer. The game is three-dimensional. If all your markers sit on a single layer, you are using only the horizontal lines and ignoring the verticals and space diagonals.
  • Ignoring the threat counter. When the counter shows two threats for the computer, it is too late to block. Watch it on every turn and act before it reaches two.
  • Blocking randomly when two threats exist. If both threats share a cell, blocking that shared cell saves you. Always check for the overlap before you give up.
  • Focusing on your own attack without scanning the computer's lines. The computer on Sharp will punish any turn you spend building while it has a threat open.
  • Forgetting that corners and centre-core cells sit on seven lines. Taking a low-value edge cell in the opening wastes your first-mover advantage.

Drawing versus winning

Although the first player can theoretically force a win, many games end in a draw when both sides play defensively. A draw happens when all sixty-four cells are filled and neither side has four in a row. This is rare but possible, especially on Gentle, where the computer does not search deeply enough to build complex forks.

If you find yourself drawing repeatedly, you are likely spending too many moves blocking and not enough building. Try to combine attack and defence in the same move: place your marker where it both extends one of your lines and blocks one of the computer's. On a board with seventy-six lines, many cells belong to lines for both sides, so these dual-purpose moves are common.

Everything runs on your own device

The line generation, the threat counting, and all the computer's search logic run entirely in your browser. Nothing is sent to a server. The game works offline after the page has loaded, and no data leaves your machine at any point.

Help

How to play 3D Tic Tac Toe

Four layers sit side by side on screen and together they are a four by four by four cube, so a winning line often runs across the screen from one layer to the next rather than sitting inside one square. You may place a marker in any empty cell on any layer, and you go first.

Read the layers

Layer one is the top of the cube and layer four the bottom. The same square on all four layers is a vertical line.

Tap an empty cell

Any empty cell on any layer, in any order. There is no gravity here.

Look for diagonals through layers

A line can start at one corner of layer one and finish at the opposite corner of layer four. Those are the lines people miss.

Watch the threat counters

The scoreboard shows how many lines each side has one marker away from finishing.

Make two threats at once

A move creating two separate lines that each need one more cell cannot be blocked.

Where the seventy-six lines come from

Sixteen lines run along each of the three axes, which is forty-eight. Each of the three ways of slicing the cube into flat squares gives four squares with two diagonals each, another twenty-four. Four more run corner to corner through the solid. That is seventy-six, and they are not typed into the code — they are generated by walking every direction from every cell and keeping the ones that fit, then counted to check. The same generation gives the line count for each cell, which is what the computer uses to decide where a move is worth making.

Good to know

Sixteen cells matter more than the rest

The eight corners and the eight cells in the middle of the cube each sit on seven lines. Every other cell sits on four.

Blocking one threat can lose to the other

Count the threats before you block. If there are two, blocking is already too late — you needed to stop the move that made both.

Vertical lines are easy to forget

Scan the same square across all four layers before every move. It is the single most common way to lose here.

Going first is a real advantage

With perfect play the first player wins this game. You have the move, so use it.

Common questions

Why are there four grids?
They are the four layers of one cube, laid out flat. A marker in the same square on every layer is a winning vertical line.
Do diagonals count?
Yes — across a face, and through the body of the cube from corner to corner.
Can the game be drawn?
In practice yes, if both sides only block. In theory the first player can always force a win.
What are threats and danger on the scoreboard?
How many lines each side has with three markers and one empty cell. Two at once usually decides it.
Is this the same as 3D tic-tac-toe?
Yes. 3D Tic Tac Toe is the name the four by four by four version was sold under.