Play
Pick a board and two players. Every agent runs in your browser, ported from the Python package. The exact solver plays perfectly while a board is small enough to solve; on bigger boards it refuses and falls back to alpha-beta, just as in the benchmark.
Score this session
0
X wins
0
Draws
0
O wins
Custom board
Is this board solvable?
Moves
How to play
- Pick a board from the presets or set your own under Custom board. X always moves first, and the first to get k in a row (across, down or diagonally) wins. With exactly k, a line longer than k does not count.
- Click an empty cell to place a stone; on big boards stones go on the grid intersections, as in gomoku. With gravity (Connect Four), click anywhere in a column and the stone drops to the lowest free cell.
- Undo takes back moves to your previous turn. Swap sides exchanges the X and O players and starts a new game.
- Set both players to agents to watch them play each other. Pause and Step let you go one move at a time. To run many games at once, use the Arena.
- The address bar keeps the board and players, so you can copy the link to share a setup.
What to expect from each opponent
| player | on small boards (tic-tac-toe, 4×4) | on big boards (Connect Four, gomoku) | time per move |
|---|---|---|---|
| Random baseline | Picks any legal move. Easy to beat. | Same: you win as soon as you make a line. | instant |
| Rule-based baseline | Never misses a win or a block, and makes and blocks forks. Hard to beat on tic-tac-toe. | Sees only one move ahead, so two threats at once (an open three in gomoku) beat it. | instant |
| MENACE learning: matchboxes | Trains before its first move (a short pause), then plays sensibly on tic-tac-toe. After 2,000 training games it still loses some games to strong opponents such as MCTS, because training hasn't covered every line; choose 10,000 games for stronger play. | Has met almost none of the positions, so most moves are random and you'll see a warning. This is where MENACE breaks. | training ~0.1–1 s once, then instant |
| Minimax exact search | Perfect play up to about (4,4,4): you can at best draw tic-tac-toe, and on boards that are a first-player win, such as (3,4,3), it wins as X. It takes the fastest win and delays losses. | Refuses: solving would take years. It plays depth-4 alpha-beta instead and says so in a yellow note. | under 1 ms on tic-tac-toe; up to ~1 s for the first move on (4,4,4) |
| Alpha-beta heuristic search | Strong at depth 3–4, though it can occasionally be tricked because it does not search to the end. | The strongest agent here. It looks depth moves ahead and scores threats, so beat it with a plan longer than its horizon. Depth 1–2 is beatable; depth 4–6 is tough. | a few ms on Connect Four, ~10–50 ms on gomoku at depth 4; deeper is slower |
| MCTS sampling | Plays well: random playouts are informative on small boards. | Weak on open boards: random playouts say little, so it misses threats. It loses to rule-based in about 10 moves on gomoku. More playouts help, slowly. | ~5–50 ms at 1,000 playouts, up to the 5 s setting |
Agents run in a background thread, so the page stays responsive while they think. The Last agent move panel shows what the agent did: nodes searched, playouts, MENACE's matchbox, or why it refused a board.