Click here to Skip to main content
16,011,711 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I have a Sudoku game that makes tables, but I can't know how to know which is easy/medium/hard.

What I have tried:

I take a Sudoku game from websites, and shuffle it without making it not valid... if I start with an easy one does it remain easy? and hard remains hard?
Posted
Updated 10-Feb-16 5:32am
v3
Comments
F-ES Sitecore 10-Feb-16 11:42am    
This isn't really a programming question. If the number of squares revealed at the beginning is less than 17 it can't be solved algorithmically. So I guess the more clues over 17 the easier the puzzle, if it is under 17 it is harder.
john1990_1 10-Feb-16 11:54am    
Do you know: If I take an easy Sudoku and shuffle it, does it remain easy and hard remain hard and medium remain medium?
ZurdoDev 10-Feb-16 12:01pm    
I suggest you post as solution.
john1990_1 10-Feb-16 12:06pm    
so easy ones remain easy and hard ones remain hard, how sure r u?

1 solution

As F-ES Sitecore says: this isn't a programming question.
And to be honest it sounds a lot like you don't know what you are doing. If you take a Sudoku puzzle and "shuffle it" the most likely result is not "easier" or "harder" - it is invalid. Remember the rules for a puzzle: 9 different digits in each of the groups of nine, nine different on each horizontal, and nine different of each vertical. If you "shuffle" the information you present to the user, it is very unlikely to conform to these rules, and thus can't be solved at all. It's a lot, lot harder to shuffle it and ensure that the result is valid than it is to generate a valid puzzle in the first place!

And as F-ES Sitecore said: the "hardness" doesn't come from any intrinsic organisation of the numbers in the puzzle, it comes from the number and location of the values you reveal to the user at the start. Shuffling the puzzle doesn't affect that except to make it a non-unique solution. For example, a "shuffled" puzzle could reveal all the "9" values, and no other. That doesn't give a unique solution, it gives a huge range of possible solutions which may well be trivial to generate from that - but not match your "solution" in any way!

Instead of trying to randomise the values, I'd start looking at how the code works - except if you are planning on selling this in the store as your previous question implies remember that you are leaving yourself wide open for litigation if you are using any code in your app that breaches in any way the licence for that software. I'd check very, very carefully if I was you...
 
Share this answer
 
Comments
john1990_1 10-Feb-16 13:01pm    
By shuffling I meant:

You can swap any row of three 3x3 blocks with any other row. You can swap any column of three 3x3 blocks with another column. Within each block row or block column you can swap single rows and single columns. Finally you can permute the numbers so there are different numbers in the filled positions as long as the permutation is consistent across the whole board.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900