FS#5519 - Sudoku: Ability to chose which difficulty to generate

Attached to Project: Rockbox
Opened by Jonas Häggqvist (rasher) - Thursday, 08 June 2006, 09:45 GMT
Last edited by Steve Bavin (pondlife) - Thursday, 17 July 2008, 10:07 GMT
Task Type Patches
Category Games
Status New
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


It would be nice if the "Generate" menu-option opened a submenu where you could pick which difficulty to generate.

I've had a quick glance at the code, and it looks like it'd have to generate until a suitable difficulty is found, but that's no different from what users have to do now, if they're after a specific difficulty, except it'd happen automatically.

If I get the time/motivation, I may have another look at it in the next couple of days.
This task depends upon

Comment by Jonas Häggqvist (rasher) - Saturday, 22 July 2006, 16:12 GMT
I have now created a patch that does this, only problem is the following warning:

"warning: passing arg 2 of `sudoku_generate' discards qualifiers from pointer target type"
Comment by Dominik Riebeling (bluebrother) - Saturday, 22 July 2006, 17:54 GMT
I tried that patch (and fixed that warning), but I ran for like hours or locked up my player / the sim (didn't wait for too long, but at least on my h120 there wasn't a result in a useful time)
Comment by Jonas Häggqvist (rasher) - Tuesday, 23 October 2007, 01:43 GMT
Updated patch by J3TC- in IRC. Untested by me.
Comment by Frank Gevaerts (fg) - Friday, 12 December 2008, 21:23 GMT
Maybe a timeout or maximum number of iterations could help, maybe with a splash on fail? You'd get a wrong difficulty of course, but at least it would end
Comment by Jonas Häggqvist (rasher) - Saturday, 13 December 2008, 20:31 GMT
This patch adds a counter that defines a maximum number of iterations to try for. It still has the error mentioned in my first comment, because I suck at C. I also don't know what a reasonable number of iterations is.

There's currently no splash on fail - it simply picks the last generated level and uses that as if everything was fine.
Comment by Jonas Häggqvist (rasher) - Saturday, 13 December 2008, 21:46 GMT
This one fixes the error - thanks to Dominik again :-)
Comment by Johannes Linke (Jaykay) - Saturday, 20 December 2008, 11:40 GMT
is this going to be committed?
Comment by Dominik Riebeling (bluebrother) - Saturday, 20 December 2008, 12:09 GMT
Is there any need to hurry? If generation simply stops and uses the last generated level that this isn't a good solution, and I think we should find a better one first (though I have no idea how to do this best). At least the user should get informed that the generated level isn't what he asked for.