问题
How many possible unique ways are there to generate a Sudoku Puzzle?? I can think of only two possible ways 1) Take a solved Sudoku puzzle and shuffle the rows and columns 2) Generate a random number and check if it violates any Sudoku constraints, repeat untill number does not violate any Sudoku constraint for every square(theoretically possible but normally it leads to deadlocking )
Are there any other ways?
回答1:
Here is a 20-page PDF, titled "Sudoku Puzzles Generating: from Easy to Evil", that you'd probably find useful in your quest.
To answer your question:
Are there any other ways?
Yes. Yes there are.
回答2:
Simple way to generate up to Take a Solved Sudoko puzzle, step 1 ) replace all 1 with A , 2 with B till 9 with I, Step 2) do a shuffle in each horizontal and vertical block block of using a random between 1 and 3, here in each there can only be 3 possible combinations. step 3) now shuffle the block there can only be 3 vertical and 3 horizontal shuffle step 4) rotate the block 1 to 4 time.. step 5) mirror the puzzle vertically and horizontally using a random between 1 and 2. step 6) replace all A with any number 1 to 9..
guessing this will produce around 38,093,690,880 combos....
来源:https://stackoverflow.com/questions/13832208/unique-methods-to-generate-sudoku-puzzle