1

I am doing a sudoku game. My problem is the generation of sudoku questions. I want to generate questions in three difficulties. Is there any idea to generate 3 level questions?

qiao
  • 17,941
  • 6
  • 57
  • 46
Zacharias Manuel
  • 8,983
  • 1
  • 17
  • 30

2 Answers2

2

If we go for pre generated sudoku puzzles, maybe you could have a look at this : http://www.setbb.com/phpbb/viewtopic.php?t=102&mforum=sudoku

we used terminal sudoku in the Linux distributions

it has a batch generator mode. the website is down but it is packaged for some linux distributions.

generate puzzles for each level : easy, medium and hard

sudoku -fcompact -ceasy -g5>sudoku_easy.txt
sudoku -fcompact -cmedium -g5>sudoku_medium.txt
sudoku -fcompact -chard -g5>sudoku_hard.txt

solve the puzzles

sudoku -fcompact -v sudoku_easy.txt >sudoku_easy-resolved.txt
sudoku -fcompact -v sudoku_medium.txt >sudoku_medium-resolved.txt
sudoku -fcompact -v sudoku_hard.txt >sudoku_hard-resolved.txt

I checked some of them and they had only one solution.

Jackson Chengalai
  • 3,907
  • 1
  • 24
  • 39
1

Generate full (filled) sudokus and before printing the sudoku out, make some percentage of the fields empty again for the human to fill.

Select random fields to empty. Raise the percentage of empty fields on each difficulty level.

jkj
  • 2,561
  • 1
  • 17
  • 24
  • @DanielFischer might not even be necessary. The original sudoku makes sure there is at least one solution. The human filled solution can then be checked separately. – jkj Jan 19 '12 at 10:08
  • But you need uniqueness, otherwise it's pointless. And uniqueness is easily lost when removing hints. – Daniel Fischer Jan 19 '12 at 10:14
  • @DanielFischer why is uniqueness required? you can just compute the user's solution and see all their values are correct or not – Seph Jan 19 '12 at 10:31
  • If there's more than one solution, it's not a logical puzzle anymore. The point is that the solution shall be found by deduction, not by trial and error. If it's not unique, that is impossible. – Daniel Fischer Jan 19 '12 at 10:36
  • @DanielFischer "Find solutions to this sudoku" ;) – jkj Jan 19 '12 at 10:40
  • Any serious Sudoku solver will hate it if it's not unique. (by definition;) – Daniel Fischer Jan 19 '12 at 10:46