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>
55 lines
1.5 KiB
Rust
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)));
|
|
}
|