Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sudoku Million Games DataSet
#1
For folks who may be interested in trying their hands at writing a Sudoku puzzle, but don't have any clue about how to make a puzzle generator, I give you -- ONE MILLION GAMES OF SUDOKU!!

Code: (Select All)
SCREEN _NEWIMAGE(1024, 720, 32)

TYPE Sudoku
Puzzle AS STRING * 81 'the puzzle from left to right, top to bottom
Answer AS STRING * 81 'the solution from left to right, top to bottom
CRLF AS STRING * 1 'chr$(10)
END TYPE

DIM Sudoku(999999) AS Sudoku
DIM m AS _MEM

temp$ = _READFILE$("sudoku.dta") 'read the compressed data file
t$ = _INFLATE$(temp$) ' inflate it

m = _MEM(Sudoku()) ' get the memblock for the data array
_MEMPUT m, m.OFFSET, t$ ' and put the data in it all at once
_MEMFREE m ' free the mem handle as we don't need it any longer


PRINT Sudoku(0).Puzzle
PRINT Sudoku(0).Answer
PRINT
PRINT

PRINT Sudoku(123456).Puzzle
PRINT Sudoku(123456).Answer

Above is the simplest way I could come up with to get that whole dataset and load it into an array for use.

If you don't want to use the memory to store the whole array, or you're wanting to bypass the disk read time to read it all, feel free to extract that file and _INFLATE it. The data is stored in very simple to read and use strings.

81 characters for the puzzle.
81 characters for the answer.
1 character for the End of Line (chr$(10)) character.

You can read those files AS RANDOM and read them one at a time. You can use SEEK and read them in LINE INPUT.

Once you have your games however you want them, all that's left at that point is just to make your interface with the grids, movement, and number input.

The puzzles are all here, along with their answers. What you decide to do with them is up to you. Smile

Print them out, so you can take them on the bus, to the doctors, or wherever you want, to play with them.
Make your own game with them.

I don't care! I just thought I'd share, in case anyone might be interested in a million games of Sudoku! Big Grin


Attached Files
.7z   sudoku.7z (Size: 68.26 MB / Downloads: 27)
Reply
#2
Thanks for sharing this. I posted a sudoku game here a couple weeks ago but used a randomizer to make puzzles.  Problem is those puzzles can have different solutions and some guess work is needed.  I may resort to using some of these puzzles instead for the next version.

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#3
Hey Steve, are these 1,000,000  puzzles broken up into the levels by any chance?  Like puzzle 1 to 250k is easy, 250k to 500k is medium, etc? 

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#4
Afraid these aren't.  They're just "puzzles" without being "rated".
Reply




Users browsing this thread: 1 Guest(s)