}
assert(nsquares > 0);
- if (nsquares > 4)
+ if (nsquares < 2 || nsquares > 4)
return 0;
if (!cage_is_region) {
* Place all the clue numbers we are given.
*/
for (x = 0; x < cr; x++)
- for (y = 0; y < cr; y++)
- if (grid[y*cr+x])
+ for (y = 0; y < cr; y++) {
+ int n = grid[y*cr+x];
+ if (n) {
+ if (!cube(x,y,n)) {
+ diff = DIFF_IMPOSSIBLE;
+ goto got_result;
+ }
solver_place(usage, x, y, grid[y*cr+x]);
+ }
+ }
/*
* Now loop over the grid repeatedly trying all permitted modes
);
if (ret > 0) {
changed = TRUE;
- kdiff = max(kdiff, DIFF_KINTERSECT);
+ kdiff = max(kdiff, DIFF_KSUMS);
} else if (ret < 0) {
diff = DIFF_IMPOSSIBLE;
goto got_result;
scratch->indexlist[i*cr+n-1] = cubepos2(diag1(i), n);
ret = solver_set(usage, scratch, scratch->indexlist
#ifdef STANDALONE_SOLVER
- , "set elimination, \\-diagonal"
+ , "set elimination, /-diagonal"
#endif
);
if (ret < 0) {
int nregions, *entered_items;
};
-static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
+static char *interpret_move(game_state *state, game_ui *ui, const game_drawstate *ds,
int x, int y, int button)
{
int cr = state->cr;
dlev.diff==DIFF_IMPOSSIBLE ? "Impossible (no solution exists)":
"INTERNAL ERROR: unrecognised difficulty code");
if (p->killer)
- printf("Killer diffculty: %s\n",
+ printf("Killer difficulty: %s\n",
dlev.kdiff==DIFF_KSINGLE ? "Trivial (single square cages only)":
dlev.kdiff==DIFF_KMINMAX ? "Simple (maximum sum analysis required)":
dlev.kdiff==DIFF_KSUMS ? "Intermediate (sum possibilities)":