Hi, I’m working on my Sudoku game.

I planned it to make a Sudoku Generator instead of wasting time to use hand-make Sudoku.

And I grouped every Lines of blocks Named by the alphabet on the left side.

How can I do it?

Here’s my model:

Hi, I’m working on my Sudoku game.

I planned it to make a Sudoku Generator instead of wasting time to use hand-make Sudoku.

And I grouped every Lines of blocks Named by the alphabet on the left side.

How can I do it?

Here’s my model:

I’m not a scripter, nor do I pretend to be. But I am an avid Sudoku fan, and I wanted to help by putting in my two cents.

First off(and you probably already know this), you can use an RNG with checks to create each number block. The following system is one I thought of(without regard to feasibility or efficiency) to create the puzzles.

- RNG generates a random number in a random square one at a time, checking against that number already being in the column, row, or box.
- RNG completes the puzzle, then second RNG removes random numbers until x amount remains(depending on difficulty).
- RNG is checked against making a truly impossible puzzle by being limited to no less than 17 clues for the hardest difficulty.

This is probably neither feasible nor efficient, but it is one way to do it. I’m not familiar with Lua to give you tips on how to accomplish this. Another possible method is to have a random generator do the same thing but create 100 puzzles for each difficult, then import those into the game with a RNG selecting which one is played by the player. Then every update cycle you can add more puzzles, as you check which ones are complete able and which ones are not.

I know this isn’t greatly helpful, but I wanted to try to give you a hand. At any rate, I wish you the best of luck and hope to play it often when it releases!!

1 Like

Although I generated the Sudoku, It was randomized and unable to solve.

(Because the Sudoku was already wrong)

I found a sudoku generator written in Lua on Github. I recommend checking that out. I can’t link it because of DevForum rules though. Just be warned, it’s over 1000 lines long.

Github should be fine. (The rule in question) is specific to #bulletin-board, but it whitelists Github anyway. I couldn’t find a *vanilla* Lua sudoku generator like the one you mentioned, (lots for LÖVE) though, so you should probably just link it.

2 Likes

I don’t know what LÖVE is, but this is the one I found.

https://github.com/PeterDwyer/PPPSudokuBlaze/blob/master/sg.lua

1 Like