mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
I've just noticed a bug in the Inertia solver: if you call it on an
already-solved grid (i.e. no gems), it will still attempt to show you a move you can make. Eliminate that special case. [originally from svn r6507]
This commit is contained in:
12
inertia.c
12
inertia.c
@ -734,6 +734,18 @@ static char *solve_game(game_state *state, game_state *currstate,
|
|||||||
int head, tail, pass, i, j, n, x, y, d, dd;
|
int head, tail, pass, i, j, n, x, y, d, dd;
|
||||||
char *err, *soln, *p;
|
char *err, *soln, *p;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before anything else, deal with the special case in which
|
||||||
|
* all the gems are already collected.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < wh; i++)
|
||||||
|
if (currstate->grid[i] == GEM)
|
||||||
|
break;
|
||||||
|
if (i == wh) {
|
||||||
|
*error = "Game is already solved";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Solving Inertia is a question of first building up the graph
|
* Solving Inertia is a question of first building up the graph
|
||||||
* of where you can get to from where, and secondly finding a
|
* of where you can get to from where, and secondly finding a
|
||||||
|
Reference in New Issue
Block a user