蛮力算法生成的数独董事会董事会、算法、数独

2023-09-11 03:33:02 作者:凉生初雨

我所开发的,最初整个数独板是空的。 一个随机的细胞(在81)的填充有随机值(1-9)。

What I am developing is that initially the entire sudoku board is empty. One of the random cells(out of 81) is filled with a random value(1-9).

现在我要填写使用暴力破解的方法的所有剩余的细胞。 从我认识了之后,谷歌上搜索的是,我们应该从第一个单元格,并用1填充它(如果它是有效的),然后填写第二个单元与2(如果它是有效的,我们将开始与一些大于检查最后填充的单元,在这种情况下是1,一旦我们达到9,我们有1重置)。

Now I want to fill all the remaining cells using brute force approach. From what I came to know after googling is that we should start with the first cell and fill it with 1(if it's valid), then fill the second cell with 2(if it's valid, we will begin checking with a number greater than the last filled cell, which in this case is 1, once we reach 9, we reset it with 1).

的事情是,它不能正常工作!

The thing is that it's not working properly!

任何人都可以联系我的精确算法。

Can anyone link me to the exact algorithm.

推荐答案

我最近做了一系列在我的博客上创建一个数独解算器在C#;你或许可以适应简单的回溯算法我present个人用途。

I recently did a series in my blog on creating a Sudoku solver in C#; you can probably adapt the simple backtracking algorithm I present to your purposes.

http://blogs.msdn.com/b/ericlippert /存档/标签/图+着色/