summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d27faf8)
commit: tweak the grid generation a bit, and fix the use of the
Solve function on a grid containing errors.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@8835
cda61777-01e9-0310-a592-
d414129be87e
game_state *solved = dup_game(currstate);
char *move = NULL;
game_state *solved = dup_game(currstate);
char *move = NULL;
- if (solve_specific(solved, DIFF_ANY, 0)) goto solved;
+ if (solve_specific(solved, DIFF_ANY, 0) > 0) goto solved;
free_game(solved);
solved = dup_game(state);
free_game(solved);
solved = dup_game(state);
- if (solve_specific(solved, DIFF_ANY, 0)) goto solved;
+ if (solve_specific(solved, DIFF_ANY, 0) > 0) goto solved;
free_game(solved);
*error = "Unable to solve puzzle.";
free_game(solved);
*error = "Unable to solve puzzle.";
for (i = 0; i < o; i++) {
j = scratch[i] + 1;
if (rownums[y*o + j-1] == 1 && colnums[x*o + j-1] == 1)
for (i = 0; i < o; i++) {
j = scratch[i] + 1;
if (rownums[y*o + j-1] == 1 && colnums[x*o + j-1] == 1)
}
/* Then try each number in turn returning the first one that's
}
/* Then try each number in turn returning the first one that's
for (i = 0; i < o; i++) {
j = scratch[i] + 1;
if (rownums[y*o + j-1] != 0 || colnums[x*o + j-1] != 0)
for (i = 0; i < o; i++) {
j = scratch[i] + 1;
if (rownums[y*o + j-1] != 0 || colnums[x*o + j-1] != 0)
}
assert(!"unable to place number under black cell.");
return 0;
}
assert(!"unable to place number under black cell.");
return 0;
+
+found:
+ /* Update column and row counts assuming this number will be placed. */
+ rownums[y*o + j-1] += 1;
+ colnums[x*o + j-1] += 1;
+ return j;
}
static char *new_game_desc(game_params *params, random_state *rs,
}
static char *new_game_desc(game_params *params, random_state *rs,