数独问题的生成

发布于 2024-12-28 05:13:19 字数 55 浏览 1 评论 0原文

我正在玩数独游戏。我的问题是数独问题的生成。我想提出三个难度的问题。有没有办法生成 3 级问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云柯 2025-01-04 05:13:19

如果我们选择预先生成的数独谜题,也许你可以看看这个:
http://www.setbb.com/phpbb/viewtopic.php ?t=102&mforum=sudoku

我们在 Linux 发行版中使用了终端数独,

它具有批处理生成器模式。
该网站已关闭,但它已针对某些 Linux 发行版进行了打包。

为每个级别生成谜题:简单、中等和困难

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

解决谜题

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

我检查了其中一些谜题,他们只有一个解决方案。

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.

ヤ经典坏疍 2025-01-04 05:13:19

生成完整(填充)的数独,并在打印数独之前,再次将一定比例的字段留空以供人类填充。

选择要清空的随机字段。提高每个难度级别的空白字段百分比。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文