I was wondering if there was a more efficient way of generating sudoku puzzles.(adsbygoogle = window.adsbygoogle || []).push({});

I already have a method to create puzzles of varying difficulties that goes something like this:

- Randomly generate a completed 9x9 solved sudoku

- Randomly remove some of the numbers from the matrix (as determined by the desired difficulty; more difficult means more are removed)

- Solve the puzzle using a logic method

- If more complex logic is needed to solve the puzzle, assign higher difficulty values

- If the final difficulty value is within the desired range, then the puzzle is good

- Else, start over.

This works, but is there a better way to more efficiently generate sudoku puzzles based on difficulty? I am trying to develop an algorithm that starts with an empty puzzle, then systematically fills in squares. The system in which it fills in squares should be different for varying levels of difficulty.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Sudoku generator

**Physics Forums | Science Articles, Homework Help, Discussion**