From: simon Date: Sun, 29 Jul 2012 21:29:26 +0000 (+0000) Subject: Don't fail an assertion when setting up the provided clues at the X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/commitdiff_plain/f646290a63e0adf65a8c3062caead98832289730 Don't fail an assertion when setting up the provided clues at the start of the solver, if they contradict each other. (Could trigger on user-provided grids.) git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9594 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/solo.c b/solo.c index 7062194..43abc1f 100644 --- a/solo.c +++ b/solo.c @@ -1773,9 +1773,16 @@ static void solver(int cr, struct block_structure *blocks, * 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