Files
systemic-game-design-course/course/08-push-chains/expansion/tests/ts/test_08x.test.ts
T
Lucas WintherandClaude Fable 5.2 8467c7929e fix(puzzle): an object steps once per movement phase; negated conversion is settled per object
Bug 1 (modules 08-10): a YOU object pulled by an earlier mover took a second step of its own. Level movement now keeps the ids that stepped in a committed plan this phase; such a YOU object starts no move, and Planner try_move answers no for it. Regression: test_08x_pulled_you_moves_once (Module 8 Expansion Drop).

Bug 2 (modules 09-10): convert honoured negation only per rule, so ALL IS ROCK beat BABA IS NOT ROCK. A target Y is now skipped for an object if any active negated rule IS NOT Y names it. Module 9 and 10 references (and their drop solutions) now carry ALL, the Module 7 Expansion Drop. Regression: test_09_negated_conversion_beats_group.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 09:18:00 +01:00

64 lines
1.5 KiB
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]);
});
test("test_08x_pulled_you_moves_once", () => {
const b = newBaba({ width: 5, height: 4, 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 [
["KEY", 0],
["IS", 1],
["YOU", 2],
["AND", 3],
["PULL", 4],
] as const) {
b.place(`text:${word}`, x, 1);
}
const key = b.place("key", 1, 3);
const baba = b.place("baba", 2, 3);
b.move("right");
expect(b.posOf(baba)).toEqual([3, 3]);
expect(b.posOf(key)).toEqual([2, 3]);
});