Module 9 lesson, scenarios, tests (8, both tracks), reference engines (TURN phase list, conversion, content-registered hazards, win/lost), WEAK Expansion Drop, harness.md M9 semantics, research notes (WEAK page, baba-is-auto Game::MovePlayer, X IS NOT X placement reading). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
2.4 KiB
Markdown
27 lines
2.4 KiB
Markdown
# Module 9 Expansion Drop: WEAK
|
|
|
|
The lesson's [Expansion Drop](../lesson.md#expansion-drop) beat explains the task. This file holds the scenario, the test locations and the check.
|
|
|
|
- Word: WEAK, a property. From the Baba Is You Wiki's WEAK page (recorded in `docs/research/baba-is-you.md` §5): "WEAK is a property that makes an object be destroyed if it overlaps any same-float object or collides with any object.", and "Destruction by WEAK happens after SINK BOOM, but before other overlap checks." The drop adds the overlap half only.
|
|
- Tests: `tests/rust/test_09x.rs` and `tests/ts/test_09x.test.ts`. Copy the one for your track into your workspace's `tests/`.
|
|
- Reference answer, one change in data and one in content code:
|
|
- `solution/words.json`, one file for both tracks: the Module 9 reference's `src/content/words.json` with one entry added, `{ "name": "WEAK", "role": "property" }`.
|
|
- `solution/rust/src/content/hazards.rs` and `solution/ts/src/content/hazards.ts`: the Module 9 reference's hazards with one hazard added, `weak`, listed after `sink`.
|
|
- Nothing under `src/engine/` changes, and neither does the harness. WEAK is a new hazard, so it is new code, but it is a hazard the engine's hazards phase runs like any other.
|
|
- Check: commit your workspace before you start, then run `node tools/expansion-check.mjs <your-workspace> <that-commit>` from the course repository. It fails if any file under `src/engine/` changed.
|
|
|
|
The other half of the WEAK page, "If a WEAK object attempts to move into a solid object and fails ... it is destroyed", is a movement check, not a hazard. The reference leaves it out and this test doesn't check it.
|
|
|
|
## Scenario
|
|
|
|
### test_09x_weak_breaks
|
|
|
|
- Setup: `newBaba` with an empty level 5 wide and 4 high. Place `BABA (0,0) IS (1,0) YOU (2,0)` and `ROCK (0,1) IS (1,1) WEAK (2,1)`. Place an object `baba` at (0,3), an object `rock` at (1,3) (the near rock) and an object `rock` at (3,3) (the far rock).
|
|
- Action: `step("right")`.
|
|
- Assertions:
|
|
- `posOf(baba)` is (1,3): a rock that is only WEAK doesn't block.
|
|
- `posOf(nearRock)` is `null` and `kindsAt(1,3)` is `["baba"]`: Baba stepped onto the near rock, and a WEAK object that shares its tile with anything is destroyed.
|
|
- `posOf(farRock)` is (3,3): alone on its tile, the far rock is untouched.
|
|
|
|
Before the drop the lexicon doesn't know `WEAK`, so `ROCK IS WEAK` spells nothing: Baba stands on the near rock and both survive.
|