mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
groupsolver: fix assertion failure.
Reproduced via 'groupsolver -v 5i:p1g4' (thanks to Arun Giridhar for the report). The Group-specific solver_hard() function ruled out a bunch of possibilities by deducing various things that couldn't be the group identity, but forgot to set done_something = true, so that it return 0 claiming it hadn't done anything. So latin_solver_top progressed to the next difficulty level and tried recursion. And latin_solver_recurse failed an assertion because it was surprised to find a cell with only one possibility - it expected that the _simple_ deductions would have ruled out any of those, which they would have if solver_hard() had returned >0, because the loop would have reset to the top and tried the easy deductions again after solver_hard() had given them something to work with.
This commit is contained in:
@ -519,6 +519,7 @@ static int solver_hard(struct latin_solver *solver, void *vctx)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
cube(i, j, j+1) = false;
|
cube(i, j, j+1) = false;
|
||||||
|
done_something = true;
|
||||||
}
|
}
|
||||||
if (cube(j, i, j+1)) {
|
if (cube(j, i, j+1)) {
|
||||||
#ifdef STANDALONE_SOLVER
|
#ifdef STANDALONE_SOLVER
|
||||||
@ -533,6 +534,7 @@ static int solver_hard(struct latin_solver *solver, void *vctx)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
cube(j, i, j+1) = false;
|
cube(j, i, j+1) = false;
|
||||||
|
done_something = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user