Just for fun simple solution of sudoku solver based on genetic algorithm
Example #1
input.txt
. 6 . | 4 . . | . . .
. . . | . . . | 9 . .
. . . | . . . | 3 4 8
------+-------+------
1 . . | . . 6 | . . 9
9 5 8 | 1 . . | . . .
. . . | 2 3 . | . . .
------+-------+------
6 . . | . . 4 | 2 3 .
. 4 . | . 2 . | . . 1
. 2 1 | . . . | 8 6 .
output:
error = 0
8 6 3 | 4 9 5 | 7 1 2
7 1 4 | 3 8 2 | 9 5 6
2 9 5 | 7 6 1 | 3 4 8
------+-------+------
1 3 2 | 8 5 6 | 4 7 9
9 5 8 | 1 4 7 | 6 2 3
4 7 6 | 2 3 9 | 1 8 5
------+-------+------
6 8 9 | 5 1 4 | 2 3 7
3 4 7 | 6 2 8 | 5 9 1
5 2 1 | 9 7 3 | 8 6 4
Example #2
input.txt
. . 3 | . 2 . | 6 . .
9 . . | 3 . 5 | . . 1
. . 1 | 8 . 6 | 4 . .
------+-------+------
. . 8 | 1 . 2 | 9 . .
7 . . | . . . | . . 8
. . 6 | 7 . 8 | 2 . .
------+-------+------
. . 2 | 6 . 9 | 5 . .
8 . . | 2 . 3 | . . 9
. . 5 | . 1 . | 3 . .
output:
error = 0
4 8 3 | 9 2 1 | 6 5 7
9 6 7 | 3 4 5 | 8 2 1
2 5 1 | 8 7 6 | 4 9 3
------+-------+------
5 4 8 | 1 3 2 | 9 7 6
7 2 9 | 5 6 4 | 1 3 8
1 3 6 | 7 9 8 | 2 4 5
------+-------+------
3 7 2 | 6 8 9 | 5 1 4
8 1 4 | 2 5 3 | 7 6 9
6 9 5 | 4 1 7 | 3 8 2