Generation of sudoku questions

萝らか妹 提交于 2019-12-11 08:24:24

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8923884/generation-of-sudoku-questions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!