After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735282 - Puzzles generated with symmetry are not always unique
Puzzles generated with symmetry are not always unique
Status: RESOLVED NOTGNOME
Product: gnome-sudoku
Classification: Applications
Component: general
3.13.x
Other All
: Normal normal
: ---
Assigned To: gnome-sudoku-maint
gnome-sudoku-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-23 13:34 UTC by Stephen
Modified: 2014-08-25 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stephen 2014-08-23 13:34:32 UTC
I found a bug in QQWing with the puzzles generated with symmetry that I implemented for you.   Since it will affect gnome-sudoku as well, I'm reporting it here.

The problem is that when symmetry is enabled for generation, puzzles are often generated that have multiple solutions.  This is due to the way that values are put back in during the puzzle generation when it is determined that they are needed for a unique solution. 

The problem arises when a center square is chosen for testing.  In that case the symmetric square is the square itself.  The value is not restored properly because it was saved with the correct value and then saved again via symmetry as an empty square (zero).  When it is restored, the zero value from the symmetry is incorrectly replaced.  

Here is the diff that fixes this bug:
https://github.com/stephenostermiller/qqwing/commit/9252f44f7251ca7802d67cb2e12e874134ebff64

The bug is fixed in the newly released version of QQWing: 1.2.0
Comment 1 Michael Catanzaro 2014-08-23 15:35:52 UTC
Thanks for the heads-up, Stephen!  I'm going to artificially bump our minimum required version to make sure distributors ship with 1.2.0.
Comment 2 Michael Catanzaro 2014-08-23 16:04:51 UTC
FYI, some of the links in the sidebar of your website (C++ source code, Java source code) seem to have broken!

Also, a suggestion for the future: it'd be better to avoid removing things from the header file, requiring the the CURRENT version bump, unless really needed, since it's annoying to deal with for downstreams (in Fedora, I have to coordinate the rebuild of qqwing with Fedora's gnome-sudoku maintainer), but bumping CURRENT was indeed necessary when you break ABI/API.

I think those constants don't actually need to be in the header at all, but could go in the .cpp file instead so that you could change them whenever you want in the future. My bad for putting them in the header in the first place.  Another trick often done for classes in public headers is to use a PIMPL [1] as the only private member variable, so that you can add new variables to the PIMPL without breaking ABI. Up to you whether you think this is worth it, of course.  What you might want to do is make these changes only if you're going to be bumping CURRENT again anyway.

[1] http://msdn.microsoft.com/en-us/library/hh438477.aspx
Comment 3 Stephen 2014-08-25 13:52:00 UTC
Sorry to create annoyances.  I ported QQWing to JavaScript and there were some items that were causing the code to be larger than it needed to be there, so I wanted to remove them.  I shouldn't need to remove anything else.

The links on the site are fixed now.