Tic-tac-toe

The classic three in a row. The shortest complete model and a good first read.

The table of Tic-tac-toe

2 players

Perfect information, no chance, one decision per turn. The lower bound of the metamodel, and the first fully executable model: every rule has an `_x` expression.

Goal and end of the game

  • Win three in a row for current
  • Draw board full without a line

How the game goes

Follow the track from top to bottom. ↻ repeats, a side track is a branch; under every step: what you decide there. Tap a step for what you decide there.

start↻ Gameper player · ends through the end conditionsPlace your mark on anempty squareby currentend of the game
All steps in words
  1. Game per player · ends through the end conditions
    1. Place your mark on an empty square by current

      Allowed if at least one empty square.

      • Choose empty squares

On the table

  • board open

Under the hood

These rules are read straight from the game's model: the same data the engine plays with. For the exact expressions, the rules diagram and the model source:

Rules diagram · Model (YAML) · Edit a copy