X to play move 0 free 9
// click a cell to call game.play(row, col)
Board3 × 3
Win counters+1 for X · −1 for O
rows
columns
diagonals
rescan the board
0
cells read · O(n²) per move
counters
0
reads · O(1) per move
Two players, one board
Play a move. Watch the counters on the right — that is how the game knows who won without ever re-reading the board.
A counter hitting ±n is a win — no scanning.