# Structure — molehill-2d

```
src/game.scene.json   the whole game's structure — holes, moles, HUD, wiring
src/behaviors.ts      Molehill (when a mole pops) + Scoreboard (what the HUD says)
src/main.tsx          React entry — mounts <App /> into #root
src/App.tsx           createGame2D, the pointer, the two behaviours
verify.ts             the headless proof — drives the MOUSE
coverage.json         the gate's two questions: can it hurt you, can it be lost
```

## The scene

```
Game            ScoreKeeper (scoreToWin 12, lives 3) — the score and the ending
├── Sky/Turf    two ColorRect2D, the backdrop
├── Field       Molehill — pops a mole, times it out
│   └── Hole00…Hole22   nine Node2D, each with
│       ├── Dirt        the hole (ColorRect2D)
│       └── Mole        ColorRect2D + `Clickable`, `visible: false` until it pops
├── Whack/Miss  two AudioPlayer, procedural presets
└── Hud         HudLayer + Scoreboard
    ├── Score / Lives   UiText
    ├── Banner          UiBanner (the ending)
    └── Again           UiButton, hidden until the game is over
```

## The wiring, all of it in JSON

| from | signal | to | handler |
| --- | --- | --- | --- |
| every `Mole` | `clicked` | `Field` | `onMoleClicked` |
| `Field` | `whacked` | `.` (the ScoreKeeper) | `addScore` |
| `Field` | `escaped` | `.` | `loseLife` |
| `Field` | `whacked` / `escaped` | `Whack` / `Miss` | `play` |
| `.` | `scoreChanged` / `livesChanged` | `Hud` | `onScore` / `onLives` |
| `.` | `won` / `lost` | `Hud` | `onWon` / `onLost` |
| `.` | `won` / `lost` | `Field` | `stop` |
| `Hud/Again` | `pressed` | `Hud` | `onAgain` |

Nine moles, one handler: `clicked` carries the node it happened on.

## The two behaviours

- **`Molehill`** — the only timing in the game. Emits `whacked` and `escaped`
  and reaches for nothing: the scoring, the sound and the ending are wires.
  `holeCount` is a read for the harness.
- **`Scoreboard`** — writes the HUD from the ScoreKeeper's signals, and owns the
  `PLAY AGAIN` reset.
