Files
systemic-game-design-course/course/08-push-chains/expansion/tests/ts/test_08x.test.ts
T
Lucas WintherandClaude Opus 5.5 bd80cefbef feat: module 08 push chains
Movement planned in full, then committed: a Planner builds a plan
(moving and destroyed ids) by running content's movement responses
(OPEN/SHUT, PUSH, STOP) for every step, rolling back failed branches.
Edge of level blocks; YOU objects move furthest-ahead first; rules are
reparsed once after movement. Harness: move/move_dir(Dir), posOf,
kindsAt. Expansion Drop: PULL as one word plus one content response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 04:05:42 +01:00

37 lines
942 B
TypeScript

// Module 8 Expansion Drop: PULL. The scenario is in expansion/README.md.
import { expect, test } from "vitest";
import { newBaba } from "../src/harness";
test("test_08x_pull_follows", () => {
const b = newBaba({ width: 5, height: 3, objects: [] });
for (const [word, x] of [
["BABA", 0],
["IS", 1],
["YOU", 2],
] as const) {
b.place(`text:${word}`, x, 0);
}
for (const [word, x] of [
["ROCK", 0],
["IS", 1],
["PULL", 2],
] as const) {
b.place(`text:${word}`, x, 1);
}
const farRock = b.place("rock", 0, 2);
const nearRock = b.place("rock", 1, 2);
const baba = b.place("baba", 2, 2);
b.move("right");
expect(b.posOf(baba)).toEqual([3, 2]);
expect(b.posOf(nearRock)).toEqual([2, 2]);
expect(b.posOf(farRock)).toEqual([1, 2]);
b.move("left");
expect(b.posOf(baba)).toEqual([3, 2]);
expect(b.posOf(nearRock)).toEqual([2, 2]);
expect(b.posOf(farRock)).toEqual([1, 2]);
});