Files
systemic-game-design-course/course/08-push-chains/expansion/tests/rust/test_08x.rs
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

55 lines
1.5 KiB
Rust

// Module 8 Expansion Drop: PULL. The scenario is in expansion/README.md.
use engine::harness::*;
#[test]
fn test_08x_pull_follows() {
let mut b = new_baba(LevelDef {
width: 5,
height: 3,
..Default::default()
});
for (word, x) in [("BABA", 0), ("IS", 1), ("YOU", 2)] {
b.place(&format!("text:{word}"), x, 0);
}
for (word, x) in [("ROCK", 0), ("IS", 1), ("PULL", 2)] {
b.place(&format!("text:{word}"), x, 1);
}
let far_rock = b.place("rock", 0, 2);
let near_rock = b.place("rock", 1, 2);
let baba = b.place("baba", 2, 2);
b.move_dir(Dir::Right);
assert_eq!(b.pos_of(baba), Some((3, 2)));
assert_eq!(b.pos_of(near_rock), Some((2, 2)));
assert_eq!(b.pos_of(far_rock), Some((1, 2)));
b.move_dir(Dir::Left);
assert_eq!(b.pos_of(baba), Some((3, 2)));
assert_eq!(b.pos_of(near_rock), Some((2, 2)));
assert_eq!(b.pos_of(far_rock), Some((1, 2)));
}
#[test]
fn test_08x_pulled_you_moves_once() {
let mut b = new_baba(LevelDef {
width: 5,
height: 4,
..Default::default()
});
for (word, x) in [("BABA", 0), ("IS", 1), ("YOU", 2)] {
b.place(&format!("text:{word}"), x, 0);
}
for (word, x) in [("KEY", 0), ("IS", 1), ("YOU", 2), ("AND", 3), ("PULL", 4)] {
b.place(&format!("text:{word}"), x, 1);
}
let key = b.place("key", 1, 3);
let baba = b.place("baba", 2, 3);
b.move_dir(Dir::Right);
assert_eq!(b.pos_of(baba), Some((3, 3)));
assert_eq!(b.pos_of(key), Some((2, 3)));
}