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>
This commit is contained in:
1 parent
638549161f
commit
8467c7929e
28 files changed
+293
-32
No files matched your search
@@ -59,18 +59,22 @@ pub struct Plan {
|
||||
pub destroyed: BTreeSet<ObjectId>,
|
||||
}
|
||||
|
||||
/// Plans one move on a board it only reads.
|
||||
/// Plans one move on a board it only reads. `stepped` holds the objects that have
|
||||
/// already stepped in this movement phase, in an earlier committed plan: an object
|
||||
/// steps at most once per phase, so none of them can step again.
|
||||
pub struct Planner<'a> {
|
||||
level: &'a Level,
|
||||
dir: Dir,
|
||||
stepped: &'a BTreeSet<ObjectId>,
|
||||
plan: Plan,
|
||||
}
|
||||
|
||||
impl<'a> Planner<'a> {
|
||||
pub fn new(level: &'a Level, dir: Dir) -> Planner<'a> {
|
||||
pub fn new(level: &'a Level, dir: Dir, stepped: &'a BTreeSet<ObjectId>) -> Planner<'a> {
|
||||
Planner {
|
||||
level,
|
||||
dir,
|
||||
stepped,
|
||||
plan: Plan::default(),
|
||||
}
|
||||
}
|
||||
@@ -100,11 +104,16 @@ impl<'a> Planner<'a> {
|
||||
/// Plan object `id` stepping one tile in the move's direction, with whatever
|
||||
/// the responses add. Returns whether it can. If it can't, the plan is left as
|
||||
/// it was before the call. An object already planned to move, or to be
|
||||
/// destroyed, is out of the way: the answer is yes, and nothing is added.
|
||||
/// destroyed, is out of the way: the answer is yes, and nothing is added. An
|
||||
/// object that has already stepped in this movement phase can't step again: the
|
||||
/// answer is no.
|
||||
pub fn try_move(&mut self, id: ObjectId) -> bool {
|
||||
if self.plan.moving.contains(&id) || self.plan.destroyed.contains(&id) {
|
||||
return true;
|
||||
}
|
||||
if self.stepped.contains(&id) {
|
||||
return false;
|
||||
}
|
||||
let level = self.level;
|
||||
let o = level.board().get(id);
|
||||
let (dx, dy) = self.dir.delta();
|
||||
|
||||
Reference in new issue
Block a user