Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

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

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

Details

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, 18:12 GMT+2
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"
(application/octet-stream)    sudoku.patch (1.9 KiB)
 sudoku/sudoku.c |   29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

Comment by Dominik Riebeling (bluebrother) - Saturday, 22 July 2006, 19:54 GMT+2
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, 03:43 GMT+2
Updated patch by J3TC- in IRC. Untested by me.
   sudoku_20071022.patch (1.8 KiB)
 apps/plugins/sudoku/sudoku.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comment by Frank Gevaerts (fg) - Friday, 12 December 2008, 22:23 GMT+2
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, 21:31 GMT+2
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.
   sudoku-difficulty-v3-FS#5519.diff (1.9 KiB)
 apps/plugins/sudoku/sudoku.c |   33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

Comment by Jonas Häggqvist (rasher) - Saturday, 13 December 2008, 22:46 GMT+2
This one fixes the error - thanks to Dominik again :-)
   sudoku-difficulty-v4-FS#5519.diff (1.9 KiB)
 apps/plugins/sudoku/sudoku.c |   33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

Comment by Johannes Linke (Jaykay) - Saturday, 20 December 2008, 12:40 GMT+2
is this going to be committed?
Comment by Dominik Riebeling (bluebrother) - Saturday, 20 December 2008, 13:09 GMT+2
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.

Loading...