[erlang-questions] Parallel Sudoku Solver

andrew cooke andrew@REDACTED
Sat May 26 13:47:28 CEST 2007


Yeah, someone else pointed that out on reddit.  Turns out that I didn't
understand the rules of Sudoku.  There's good news, bad news, and good
news...

- Good news: The approach I used was general enough for the rule change to
be trivial to implement.

- Bad news: It then didn't converge after running for 8 hours.

- Good news: It was pretty easy to change the algorithm so that each
"block" of 9 digits works together as a "community" to maintain as an
invariant the use of the digits 1-9.  With that change it converges very
quickly.

The final code is at http://www.acooke.org/cute/CommunityS0.html

Andrew


>
> Andrew wrote:
> PS Ooops forgot: http://www.acooke.org/cute/ParallelSu0.html
> (end of quote)
>
> % > io:fwrite("~s", [Piccy]).
> % 4 5 1 | 1 4 6 | 8 3 5
> % 8 3 7 | 9 2 5 | 7 1 9
> % 2 6 9 | 7 8 3 | 6 4 2
> % ---------------------
> % 9 2 4 | 2 9 7 | 3 6 8
> % 6 7 3 | 3 8 4 | 4 5 1
> % 8 5 1 | 5 1 6 | 9 2 7
> % ---------------------
> % 7 8 9 | 6 1 3 | 5 7 2
> % 5 6 2 | 2 9 8 | 1 4 6
> % 1 3 4 | 4 7 5 | 3 9 8
>
> sorry, that wrong answer for sudoku :) for sudoku not only in 3*3 cell
> must all numbers be uniq, but also in every line and column.
> so,
> % 4 5 1 | 1 4 6 | 8 3 5
> is incorrect line -- you have 1, 4, 5 twice, and no 2 at all...
> --
> --- suicide proc near\n call death\n suicide endp
> _________________________________________________________
> Post sent from http://www.trapexit.org
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>





More information about the erlang-questions mailing list