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


Messages In This Thread
Sudoku Million Games DataSet - by SMcNeill - 06-24-2024, 06:02 PM
RE: Sudoku Million Games DataSet - by Dav - 06-25-2024, 01:06 PM
RE: Sudoku Million Games DataSet - by Dav - 06-28-2024, 03:35 PM
RE: Sudoku Million Games DataSet - by SMcNeill - 06-28-2024, 06:58 PM



Users browsing this thread: 1 Guest(s)