- Joined
- Jan 9, 2022

- Messages
- 1,003

- Reaction score
- 1,419

- First Language
- English

- Primarily Uses
- RMMZ

Anyway, as I referenced in a recent status post, I got it in my head that I could Event a Sudoku game. Which, as it turns out, I can. I am actively working on it right now and probably doing it the most complicated and inefficient way possible. But still having fun.

Now, I have been pondering how to Event check the solution to the puzzle and I have come up with a few different options. I am wondering what folks think and if anyone can think of a better and more efficient way that I just can’t see.

For background, from my research, apparently, a “proper” Sudoku puzzle is supposed to have only one solution. It also appears that it is possible for a puzzle to have more than one solution, especially the less starting hints are provided. There has actually been significant time and energy devoted to figuring out the minimum number of hints required for a “proper” Sudoku puzzle with only one solution. Apparently that minimum hint number is 17.

With that said, I am making a Sudoku and Sudoku-Like puzzle game. Because it seems like I can so why not? And I keep coming up with additional ways to massage the puzzle experience. And I have no intentions at this time of trying to make something like this commercial.

For me, Sudoku-Like means that it would be possible for the puzzle to have more than one solution. Because you could also play around with letting the player determine how many hints (with a minimum and maximum) and even let the player select their own hint spots. If the player selects the hint locations poorly, that just makes the puzzle harder to figure out with more initial guessing and trial and error.

Specifically regarding how to check the solution that the player submits. I will present the options I am considering with the Pros and Cons that I can see.

For additional background with the options below, please consider that in a Sudoku Puzzle, each Row, Column, and 3x3 group of squares must have the numbers 1-9 without any repeats. This also means that the total value of each Row, Column, and 3x3 group will be 45. And the total value of the entire puzzle would be 405 (45 x 9).

The way I am currently building the game, I allow the player to put whatever number from 1-9 that they want in any square. It isn’t until the player selects the option to check their solution that the numbers they placed are actually checked. I am using 81 Variables (9 x 9 Squares).

Also, the player would have no idea how the solutions are being checked so it would be less likely that a player could purposefully exploit any option. This relates to Option 1 below which isn't technically 100% accurate.

__Option #1__Calculate the total value of the inputted Variables of each Row, Column, and 3x3 group to ensure that each one totals 45. Also, calculate the total value of the entire puzzle to ensure that it totals 405.

*Pros:*Only requires 28 calculations. Any calculation that isn’t the correct total would result in an incorrect solution.

This appears to allow for multiple solutions to a Sudoku-Like puzzle.

This method would support reducing the number of starting hints or allowing the player to choose their hints.

*Cons:*Technically, this method would not be 100% accurate. It is possible that a player could repeat numbers in a Row, Column, or 3x3 group that still add up to 45. However, the likelihood of that happening is incredibly remote. Especially with the addition of the total puzzle count of 405.

With this method, I couldn’t show the player that any particular Row, Column, or 3x3 group contains an error.

__Option #2__Push the player inputted values into an Array for each Row, Column, and 3x3 group. Then check each Array to see if it contains the numbers 1-9.

*Pros:*This only requires checks of 27 Arrays.

This method would appear to be 100% accurate.

I could use this method to highlight to the player what Row, Column, or 3x3 grid contains an error.

This appears to allow for multiple solutions to a Sudoku-Like puzzle.

This method would support reducing the number of starting hints or allowing the player to choose their hints.

*Cons:*Requires 27 more Variables to use as Arrays.

Requires the extra step of adding all the player inputted Variable values into the appropriate Arrays.

__Option #3__Have each of the 81 Variables for the puzzle be hard set with a correct value. Check each of the 81 Variables to confirm that the player inputted value is correct.

*Pros:*This should be 100% accurate for only one solution (“proper” Sudoku).

This allows greatest accuracy in identifying to the player the squares that have incorrect values.

*Cons:*Requires 81 checks to compare Variables. Or perhaps a Scripted Loop check that I would have to research how to implement.

Requires 81 additional Variables to store the correct values.

This method would not allow for multiple solutions for a Sudoku-Like puzzle.

This method would not support reducing the number of starting hints or allowing the player to choose their hints because the player could legitimately submit a correct solution that is not recognized.

Each unique puzzle requires coding the correct Variable values for 81 Variables.

Currently, after writing this out, I am leaning toward Option #2. That options seems to have the most Pros and the least Cons.

But I am interested in hearing other people’s thoughts.

Which option would you choose?

Are there other potential Pros and Cons that I haven’t noticed?

Is there another option that might be easier or more efficient to implement?

Thanks for taking the time to read through this and share your thoughts!

Making this Sudoku Game is surprisingly fun, if not a bit repetitive.

**EDIT: I should clarify that this is entirely Evented/Scripted with NO plugins.**