~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Factual and other corrections/additions to the Guess docs.
[sgt/puzzles]
/
twiddle.c
diff --git
a/twiddle.c
b/twiddle.c
index
8388f47
..
8000780
100644
(file)
--- a/
twiddle.c
+++ b/
twiddle.c
@@
-363,7
+363,14
@@
static char *new_game_desc(game_params *params, random_state *rs,
*/
oldtotal = prevmoves[y*rw+x];
newtotal = oldtotal + r;
*/
oldtotal = prevmoves[y*rw+x];
newtotal = oldtotal + r;
- } while (abs(newtotal) < abs(oldtotal) || abs(newtotal) > 2);
+
+ /*
+ * Special case here for w==h==n, in which case
+ * there is actually no way to _avoid_ all moves
+ * repeating or undoing previous ones.
+ */
+ } while ((w != n || h != n) &&
+ (abs(newtotal) < abs(oldtotal) || abs(newtotal) > 2));
do_rotate(grid, w, h, n, params->orientable, x, y, r);
do_rotate(grid, w, h, n, params->orientable, x, y, r);
@@
-539,8
+546,8
@@
static int compare_int(const void *av, const void *bv)
return 0;
}
return 0;
}
-static game_state *solve_game(game_state *state, game_
aux_info *aux
,
- char **error)
+static game_state *solve_game(game_state *state, game_
state *currstate
,
+
game_aux_info *aux,
char **error)
{
game_state *ret = dup_game(state);
int i;
{
game_state *ret = dup_game(state);
int i;