SCENARIOS / SC-003 / PAC-MAN
SC-003 Game AI

Pac-Man

A self-playing arcade game — ghosts chase a flood-filled distance field.

Async Tick Spatial FSM
Game replay — pellets, ghosts and frightened windows FULLSCREEN ⤢
Clock 60 Hz tick
Update Asynchronous
Step order Fixed (load-bearing)
Ghosts 4 personalities
Topology Spatial maze
OVERVIEW

Pac-Man modelled end-to-end: a maze of cells, a singleton game-state, four ghosts and Pac-Man himself. On each turn Pac-Man emits a wave message that propagates through the maze as a breadth-first distance field; the ghosts read that gradient to chase, each biased by its personality. Power pellets flip the game into frightened mode, and the game-state machine watches the pellet count and lives to call the win or loss.

A showcase of message-driven computation: a whole shortest-path field is built by cascading messages between cells within a single turn, with a load-bearing fixed step order (ghosts, then cells, then game-state, then Pac-Man) that keeps the chase deterministic. Good for testing pursuit, planning and adversarial reasoning against reproducible game traces.

TRAITS
Async
Independent, event-driven timelines
Tick
Discrete fixed-step time
Spatial
Entities have position & topology
FSM
Entities are finite-state machines
SCHEMA

Linked tables with guaranteed referential integrity.

TABLECOLUMNSDESCRIPTION
pacman ID, home_tag, pellets_eaten, current_cell_id, game_id, current_state The player: pellets eaten, its current cell and game references.
ghost ID, personality, home_tag, current_cell_id, game_id, pacman_id, current_state Four ghosts: personality (Blinky/Pinky/Inky/Clyde), current cell and chase target.
mazecell ID, kind, home_tag, has_pellet, has_power, pac_grad, ghost_count, pacman_here, north_id, south_id, east_id, west_id, current_state One row per maze cell: pellet/power flags, the BFS distance value and four wall-aware neighbour references.
gamestate ID, score, lives, pellets_remaining, frightened_timer, running, current_state Singleton game state: score, lives, pellets left and the frightened-mode timer.
LIVE API

Generated REST endpoints. Also exposed as MCP tools.

POST /scenarios/pacman/experiments Seed a new game
POST /scenarios/pacman/experiments/{eid}/run Advance the game N turns
GET /scenarios/pacman/experiments/{eid}/entities/ghost Read ghost positions and modes
GET /scenarios/pacman/experiments/{eid}/events Append-only event log
GET /scenarios/pacman/experiments/{eid}/dataset Download the exported dataset
SEMANTIC LAYER

OSI-compatible definition, emitted with the dataset.

# pacman.osi.yaml — emitted automatically
semantic_model:
  name: "pacman"
  source: "duckdb://pacman.db"
  entities:
    - name: pacman
      primary_key: id
  dimensions:
    - name: state
      type: categorical
    - name: t
      type: time
  measures:
    - name: row_count
      agg: count
    - name: active
      agg: sum
      filter: "state = 'ACTIVE'"