Bug 217925

Summary: Difficulty level selector appears not to have any effect
Product: [Applications] ksudoku Reporter: Christopher Neufeld <kdebugs>
Component: generalAssignee: Johannes.Bergmeier
Status: RESOLVED FIXED    
Severity: normal CC: bucky, bugs.kde.org, chris-hartmann, d-ulrick, dchipper, iandw.au, kde-games-bugs, kribjo, mkott, pulbrich, scottme, tobias, tony.pott, uli, uwp
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 1.0 (KDE SC 4.8)
Sentry Crash Report:

Description Christopher Neufeld 2009-12-08 22:22:27 UTC
Version:            (using Devel)
Compiler:          gcc-4.2.4 
OS:                Linux
Installed from:    Compiled sources

Recent (within the past two weeks or so) compiles of ksudoku appear not to have a working difficulty level slider.  No matter what setting is chosen, puzzles of apparently random difficulty arise.  I expect this is due to the new engine having been slotted in around that time.

I generated 5 consecutive games of standard sudoku at the lowest and highest difficulty levels.  The five games at the lowest difficulty level had revealed cells counts at the start of 40, 48, 33, 29, 42, for an average of 38.4 revealed cells.  At the highest difficulty, the cell counts were 35, 50, 48, 31, 47, for an average of 42.2 revealed cells.  There doesn't appear to be any statistically significant effect of selecting the difficulty level slider.
Comment 1 Christian Hartmann 2010-01-25 18:32:44 UTC
This bug is also in KDE SC 4.4 RC2. Should be fixed for final release...
Comment 2 Johannes.Bergmeier 2010-01-27 01:23:31 UTC
The problem is, that I need to set a good difficulty - rating. The old algorithm tried to remove cells n-times without making the game unsolvable. n is some number which got calculated from the size of the board, the difficulty and some other variables. This was the reason that while they had random difficulty it averaged in some range.

The new algorithm generates a game by filling in number until the result is solvable. The problem is to find a good metric when that solvability is sufficient for a specific difficulty.

My original plans were a custom metric that could rate a game when solving it. Unfortunately I can't finish it in time for KDE SC 4.4. So I need a simpler yet sufficient approximation of difficulty.
Comment 3 Christian Hartmann 2010-01-27 08:37:19 UTC
Wouldn't it be easier to go back to the old algorithm for 4.4 final and change to a new one, when it's done, e.g. for 4.4.1?

Otherwise there might be many complaints that it doesn't work any longer...
Comment 4 Christopher Neufeld 2010-01-27 17:16:20 UTC
Just to advance a thought for future consideration.  A sudoku puzzle program I wrote some time ago evaluated the difficulty of the puzzle based on the effort required to solve it using the techniques that I used myself.  Sort of like Mr. Spock "giving the computer an understanding of the game equal to my own."

I divided my solving rules into two categories, "easy" and "hard".  I defined a puzzle as "easy" if it could be solved using only the application of easy rules.  A puzzle was "medium" if it could be solved using at least one application of a hard rule.  A puzzle was "hard" if my set of rules couldn't solve the puzzle as presented.  To help in the "hard" case, I had pop and push keystrokes that let me try out a value, and if I decided that it was incorrect I could pop back to the previous push, it would show me the state of the puzzle at that point and the (presumably) incorrect choice I made immediately after the push.

Something like this could be combined with your system.  Before obscuring a cell, you see what difficulty level would be required to solve the system.  If obscuring that cell raises the difficulty too high, don't obscure it, go on to another one.

In case you're curious, my puzzle software (written in SBCL or GNU lisp + ncurses) has source code available from the page:  http://www.cneufeld.ca/neufeld/lisp/sudoku.html
Comment 5 Parker Coates 2010-05-12 16:57:39 UTC
*** Bug 228614 has been marked as a duplicate of this bug. ***
Comment 6 Parker Coates 2010-05-12 16:57:51 UTC
*** Bug 237362 has been marked as a duplicate of this bug. ***
Comment 7 Dave Ulrick 2010-06-18 06:44:27 UTC
The problem still appears to be present in KDE 4.4.4:  many generated puzzles are very easy even though the difficulty slider is moved all the way to "Hard."
Comment 8 UWP 2010-06-24 13:40:55 UTC
I can confirm this. After updating von Ubuntu 9.10 to 10.04 the game is way too easy now and therefore unusable. Please change it back to the old algorithm!
Comment 9 Holger Ackermann 2010-07-06 23:48:53 UTC
This bug took away all the joy of playing ksudoku for me. I'd revert to 4.3.5 if I could without reverting the KDE 4.4 update. But unfortunately... The old algorithm worked way better for me and I'd really prefer the old algorithm over the current one.

Johannes, any progress? Please give us a short update.
Comment 10 Tony Pott 2010-07-17 16:17:44 UTC
I agree entirely with Holger Ackermann's comment.
The game as it is now isn't, for most people, worth playing. Certainly I can't use it, since the speed I finish is now no longer determined by how much I have to think, but merely by how fast I can click the mouse. 

Shouldn't a bug which renders an application generally useless have a higher priority than 'NORMAL'? This bug is now 8 months old!
Comment 11 uli 2010-09-10 12:20:25 UTC
I loved ksudoku very much. Now it is no longer usable due to this bug.
Comment 12 Holger Ackermann 2010-10-03 20:18:01 UTC
No comment from a dev for 9 months? Very sad! Please someone give us an update.
Comment 13 Dirk Fröhlich 2011-03-07 14:00:49 UTC
Still present in 4.6
Until this is resolved, I'm stuck with running ksudoku from 4.3.5
Comment 14 Christoph Feck 2011-10-22 00:43:53 UTC
*** Bug 284639 has been marked as a duplicate of this bug. ***
Comment 15 Ian Wadham 2011-11-07 10:26:01 UTC
I have replaced the puzzle generator and solver in KSudoku with a completely new generator and solver based on published algorithms. It will be released in KDE SC 4.8, due out in late January 2012. The new algorithms provide a full range of difficulties, from Very Easy to Diabolical and beyond, which have been tested against ratings of puzzles published in newspapers and on the Internet. Enjoy!

See http://techbase.kde.org/Schedules/KDE4/4.8_Feature_Plan#kdegames for further details of changes to KSudoku in KDE SC 4.8.