Files
systemic-game-design-course/course/03-death-step/reference/rust
Lucas WintherandClaude Opus 5.5 97c64ebee8 feat: log tree from Module 2 (logTree / log_tree); SpellGrid CLIs print Log:
Engine events carry the nesting depth they were recorded at; the harness
prints the log as an indented tree. New tests test_02_log_tree_shows_nesting
and test_03_log_tree_death_phase; both SpellGrid CLIs print the tree of the
last command's Sequences under a Log: line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:23:59 +01:00
..
2026-10-29 02:42:12 +01:00
2026-10-29 02:42:12 +01:00
2026-10-29 02:42:12 +01:00
2026-10-29 02:42:12 +01:00

Module 3 reference engine (Rust)

The course's own engine as of the end of Module 3. It adds deferred death: damage and destroy effects only mark minions, and the Death Creation Step removes them when the outermost Phase ends, followed by Death Phases that resolve Deathrattles until no new deaths occur. Module 2's reference was the starting point, so a diff between the two shows what this module adds. Module 4's reference starts from this one.

  • src/engine/: generic machinery. Names no cards.
    • queue.rs: actions, the context an effect sees, and the resolver. A Sequence performs its action, then runs the end-of-outermost-Phase steps and the Death Phase loop. Module 4's aura updates go in the marked seam next to the Death Creation Step. A Death Phase is the same Phase function as a damage reaction, fed Death Events; the dead minion answers its own Death Event with its Deathrattle.
    • death.rs: the Death Creation Step. It collects every mortally wounded or pending-destroy minion, reads all their board positions first, then removes them together and returns their Death Events in order of play.
    • world.rs: entities, zones, order of play, heroes, stats, Armor, the pending-destroy flag and the log. Every state change records its event, except marking a minion pending destroy, which the course log does not show.
    • card.rs: card definitions (stats, triggers, a spell's effect) and the library.
    • event.rs: the engine's events. A Death Event also carries the remembered board position. src/harness.rs translates them into the course's GameEvent.
  • src/content/mod.rs: card definitions. Each effect is a small function that returns actions; Module 5 turns them into data.
  • src/harness.rs: the adapter the course tests call. destroy runs one Sequence that marks its target. play is still the Module 1 Expansion Drop stub.

Run it with the module's tests: node tools/verify-references.mjs 03 from the course repository.