Appearance
Lesson 00 — The game as state transitions
Where this lesson fits: before opening the solution. The goal is to make the nouns and state transitions visible before MonoGame APIs enter the picture.
Time: 45–60 minutes
Prerequisites
None. This is a paper exercise. Read getting started before lesson 01; you do not need a project yet.
Learning objectives
By the end, you can explain the capture loop, name the system that owns each kind of space, and distinguish per-level, per-run, and profile state.
The model
Last Perimeter has three spatial truths:
| What the player sees | What owns it |
|---|---|
| Traversable safe edge | PlayableWallPath, derived from arena tiles |
| Temporary exposed line | active Trail |
| Permanent territory | authoritative tile state in ArenaSystem |
A trail is not yet a claim. It is an input to a solver. A solver result is not yet live state. It must be applied to the arena before the path is rebuilt.
Guided activity
- Draw an arena rectangle and mark one claimed block, one unclaimed region, and a trail that divides it.
- Label which shapes are authoritative data and which are derived from that data.
- Add an enemy to one region. The solver chooses the smallest enemy-free region; if all regions contain enemies, it chooses the smallest region and identifies its enemies for removal. Predict the chosen region.
- On a second sketch, show a failed trail that partitions nothing. Write down what must remain unchanged.
- Add three lifetimes to the side of the sketch: level state, run state, and profile state.
Checkpoint
Explain why the project keeps ArenaSystem, PlayableWallPath, and Trail separate. A good answer says which owns truth, which is derived, and which is temporary.
Common confusion
Do not call every line a wall. The trail is temporary; the wall path is rebuilt from committed arena state.
Questions and extension
- Which state should reset after a level, after a run, and after the application closes?
- Extend the sketch to show where scoring, enemy removal, and renderer invalidation occur after a successful claim.

