Bug 217926 - ksudoku sometimes claims a successful puzzle has errors
Summary: ksudoku sometimes claims a successful puzzle has errors
Status: RESOLVED FIXED
Alias: None
Product: ksudoku
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: HI major
Target Milestone: ---
Assignee: Johannes.Bergmeier
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-08 22:34 UTC by Christopher Neufeld
Modified: 2018-05-15 16:52 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
The valid solution that I got that was marked with errors (187.07 KB, image/png)
2010-01-09 18:16 UTC, Ben Klein
Details
wrong sudoku (320.09 KB, image/png)
2010-02-03 00:04 UTC, Roman K.
Details
The saved game having the solved puzzle (5.03 KB, application/octet-stream)
2010-03-03 22:43 UTC, Dhaval Giani
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Neufeld 2009-12-08 22:34:05 UTC
Version:            (using Devel)
Compiler:          gcc-4.2.4 
OS:                Linux
Installed from:    Compiled sources

Since the new engine went in, the majority of games that I complete report that there are errors in the solution.  The games are the X-sudoku variant.  I fill all of the cells, and get a message that the solution contains errors, informing me to turn on error display to show the problem cells.  When I turn on that setting, no cells are highlighted in red.  If I click on the "SOLVE" button, it blanks one of the (correct) cells in the solution, and then claims that this is the correct solution, even though there is now one missing number on the board.

You can often see this effect.  Start a new game.  Correctly fill in at least one cell.  Click the "SOLVE" button, and notice that the claimed solution is missing one number.
Comment 1 Ben Klein 2010-01-09 18:16:29 UTC
Created attachment 39714 [details]
The valid solution that I got that was marked with errors
Comment 2 Ben Klein 2010-01-09 18:17:18 UTC
I got the same problem with a 9x9, standard sudoku (see attachment).
Comment 3 Johannes.Bergmeier 2010-01-09 18:27:38 UTC
It is a bug in the solver. I'm investigating it but haven't had enough time to find its root. This is currently the bug with highest priority on my TODO list.
Comment 4 Johannes.Bergmeier 2010-01-20 22:34:50 UTC
Small note on the progress (in the case someone wants to help me):
4x4 Sudokus have this problem in about roughly 50% of cases. As they are really small it shouldn't be to difficulty to locate the bug with help of them.
Comment 5 Johannes.Bergmeier 2010-01-20 22:40:11 UTC
To fix this bug is very important, as it is a really show-stopper.
Comment 6 Ben Klein 2010-01-22 16:53:00 UTC
In the "this is clearly wrong" department, an empty Tiny Samurai puzzle is consistently reported as having no solution.
Comment 7 Johannes.Bergmeier 2010-01-23 01:25:27 UTC
Ok, I think, I found one of the potential roots of this evil. The solver accepts a solution when all cells have only one marker left. This can be before all cells have their value set. (It might even occur that a puzzle is invalid but the solver has not checked all rules. But this is only a theoretical problem, I haven't encountered it)

I try to fix this tomorrow.
Comment 8 Johannes.Bergmeier 2010-01-27 01:05:00 UTC
SVN commit 1080811 by joselb:

- Fixed bug of wrong solutions
- Correct solutions should now get identified as such
- Added 2 small methods that could be used for debugging


BUG:217926

 M  +6 -0      constraint.cpp  
 M  +1 -0      constraint.h  
 M  +4 -0      constrainthelperstorage.cpp  
 M  +1 -0      constrainthelperstorage.h  
 M  +1 -0      ruleset.h  
 M  +1 -1      solver.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1080811
Comment 9 Roman K. 2010-02-03 00:04:10 UTC
Created attachment 40483 [details]
wrong sudoku

I'm using Version 0.5 under KDE 4.3.98 (KDE 4.4 RC3) and I also had a problem that has to do with the solver I think. look at the attached screenshot, this was the proposed solution, which actually is wrong, if you look in the bottom left square (no "1", two times "2"). I even think that this game was not valid (or solvable or how you would call it)
Comment 10 Johannes.Bergmeier 2010-02-03 00:32:37 UTC
seams that the solver still has some corner cases where it will not work as expected.
Comment 11 Russell Jones 2010-02-25 21:05:47 UTC
Just ran into this bug on ksudoku 0.5/KDE 4.4 final. The specific puzzle (standard 9x9, hardest difficulty) was:
__5 24_ __9
1__ 65_ 37_
6__ 873 5_2

___ ___ __3
3__ ___ ___
_6_ 437 9_5

___ 7__ 4__
487 __2 63_
5__ ___ __7

Upon finishing, I obviously got the "solution contains errors" message, and after I glanced over the puzzle to see that wasn't the case, I went into the settings and turned on "show errors" which didn't reveal any red cells.

Then I kept tapping "Hint" to have it fill in the puzzle, and eventually found something that might be of use: the hint got to R5C8, and overwrote my 8 with a locked _blank cell_. Deleting and reentering a number at that point solved the puzzle according to KSudoku, but of course now there was no way to get the 8 back.

(On a side note, that seemed like a very easy puzzle for its difficulty setting, in case there turns out to be a bug in that component too.)
Comment 12 C. Brouerius van Nidek 2010-03-01 15:49:07 UTC
"solution contains errors" is the main problem but the very easy puzzles that are regularly offered under difficulty hard is a bug too.
Comment 13 Dhaval Giani 2010-03-03 22:42:01 UTC
I can also confirm hitting this error. Also the puzzle generated was very easy, even though I had selected very difficult. I will attach a copy of the saved game. Hope that helps
Comment 14 Dhaval Giani 2010-03-03 22:43:01 UTC
Created attachment 41302 [details]
The saved game having the solved puzzle
Comment 15 Christopher Neufeld 2010-03-03 22:47:30 UTC
The "hard" puzzles sometimes being very easy is a different bug, specifically bug 217925.
Comment 16 Johannes.Bergmeier 2010-03-08 00:04:11 UTC
SVN commit 1100590 by joselb:

- Fixed bug for the 4.4 branch (missed to backport the fix of trunk)
BUG:217926

 M  +5 -6      solver.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1100590
Comment 17 Christopher Neufeld 2010-06-10 21:48:55 UTC
I haven't seen this happen for at least several weeks now.  I'm the original reporter, I'm marking this as verified fixed.