You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-90Lines changed: 36 additions & 90 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,58 +3,33 @@ Sudoku-Solver
3
3
4
4
This is another simple sudoku solver. Have fun!
5
5
6
-
##How to install
7
-
[Download the latest](http://www.github.com/Neehan/Sudoku-Solver/releases) Sudoku-Solver and unzip it. Run `Sudoku-Solver` (for ubuntu) or `Sudoku-Solver.exe` (for windows). That's it.
8
-
You can also try an online demo: http://goo.gl/FIwMsp
6
+
How to install
7
+
--------------
8
+
Download [the latest release](http://www.github.com/Neehan/Sudoku-Solver/releases) of `Sudoku-Solver`, unzip it, and run `Sudoku-Solver` (for ubuntu) or `Sudoku-Solver.exe` (for windows). That's it. Alternatively, you can run the [`Makefile`](Makefile) to build from source.
9
9
10
-
##How to use
11
-
12
-
###Method 1
13
-
14
-
Write the value of each cell separated by a space. Value of an empty cell is either `0` or `.` . However, you may make a typo while typing the sudoku. That's why I recommend the alternative method.
15
-
16
-
###Method 2
17
-
18
-
Open `sudoku.txt`. You will see two blank sudokus there. One with empty cells as `.`, and the other with `0`. Choose whichever you prefer and substitute the cells with clues from your sudoku. Now copy the sudoku and close the file without saving. After that run the Sudoku-Solver, paste the sudoku and then press enter.
19
-
20
-
##Example
21
-
22
-
Let's solve the following sudoku.
23
-
```
24
-
+---+---+---+---+---+---+---+---+---+
25
-
| 1 | | | 9 | 2 | | | | |
26
-
+---+---+---+---+---+---+---+---+---+
27
-
| 5 | 2 | 4 | | 1 | | | | |
28
-
+---+---+---+---+---+---+---+---+---+
29
-
| | | | | | | | 7 | |
30
-
+---+---+---+---+---+---+---+---+---+
31
-
| | 5 | | | | 8 | 1 | | 2 |
32
-
+---+---+---+---+---+---+---+---+---+
33
-
| | | | | | | | | |
34
-
+---+---+---+---+---+---+---+---+---+
35
-
| 4 | | 2 | 7 | | | | 9 | |
36
-
+---+---+---+---+---+---+---+---+---+
37
-
| | 6 | | | | | | | |
38
-
+---+---+---+---+---+---+---+---+---+
39
-
| | | | | 3 | | 9 | 4 | 5 |
40
-
+---+---+---+---+---+---+---+---+---+
41
-
| | | | | 7 | 1 | | | 6 |
42
-
+---+---+---+---+---+---+---+---+---+
43
-
```
44
-
Following method 1, the input will be,
10
+
How to use
11
+
-----------
12
+
Feed this program your sudoku from `stdinput`. Blank cells has to be replaced by either `0` or `.`. The program will discard all other characters and wait until 81 valid inputs (for 81 cells of your sudoku) are provided.
45
13
14
+
Example
15
+
--------
16
+
Let's solve the following sudoku with `Sudoku-Solver`.
46
17
```
47
-
1 0 0 9 2 0 0 0 0
48
-
5 2 4 0 1 0 0 0 0
49
-
0 0 0 0 0 0 0 7 0
50
-
0 5 0 0 0 8 1 0 2
51
-
0 0 0 0 0 0 0 0 0
52
-
4 0 2 7 0 0 0 9 0
53
-
0 6 0 0 0 0 0 0 0
54
-
0 0 0 0 3 0 9 4 5
55
-
0 0 0 0 7 1 0 0 6
18
+
+-------+-------+-------+
19
+
| 1 . . | 9 2 . | . . . |
20
+
| 5 2 4 | . 1 . | . . . |
21
+
| . . . | . . . | . 7 . |
22
+
+-------+-------+-------+
23
+
| . 5 . | . . 8 | 1 . . |
24
+
| . . . | . . . | . . . |
25
+
| 4 . 2 | 7 . . | . 9 . |
26
+
+-------+-------+-------+
27
+
| . 6 . | . . . | . . . |
28
+
| . . . | . 3 . | 9 4 5 |
29
+
| . . . | . 7 1 | . . 6 |
30
+
+-------+-------+-------+
56
31
```
57
-
Or,
32
+
## Input
58
33
```
59
34
1 . . 9 2 . . . .
60
35
5 2 4 . 1 . . . .
@@ -66,54 +41,25 @@ Or,
66
41
. . . . 3 . 9 4 5
67
42
. . . . 7 1 . . 6
68
43
```
69
-
If you follow method 2, the input will be,
70
-
```
71
-
1 0 0 | 9 2 0 | 0 0 0
72
-
5 2 4 | 0 1 0 | 0 0 0
73
-
0 0 0 | 0 0 0 | 0 7 0
74
-
------+-------+------
75
-
0 5 0 | 0 0 8 | 1 0 2
76
-
0 0 0 | 0 0 0 | 0 0 0
77
-
4 0 2 | 7 0 0 | 0 9 0
78
-
------+-------+------
79
-
0 6 0 | 0 0 0 | 0 0 0
80
-
0 0 0 | 0 3 0 | 9 4 5
81
-
0 0 0 | 0 7 1 | 0 0 6
82
-
```
83
-
Or,
84
-
```
85
-
1 . . | 9 2 . | . . .
86
-
5 2 4 | . 1 . | . . .
87
-
. . . | . . . | . 7 .
88
-
------+-------+------
89
-
. 5 . | . . 8 | 1 . .
90
-
. . . | . . . | . . .
91
-
4 . 2 | 7 . . | . 9 .
92
-
------+-------+------
93
-
. 6 . | . . . | . . .
94
-
. . . | . 3 . | 9 4 5
95
-
. . . | . 7 1 | . . 6
96
-
```
97
44
**Note: The given sudoku must have at least one solution.**
98
-
##Sample Output
45
+
## Output
99
46
```
100
47
+-------+-------+-------+
101
-
| 7 5 1 | 8 4 6 | 2 3 9 |
102
-
| 8 9 2 | 3 7 1 | 4 6 5 |
103
-
| 6 4 3 | 2 5 9 | 8 7 1 |
48
+
| 1 7 8 | 9 2 6 | 4 5 3 |
49
+
| 5 2 4 | 3 1 7 | 8 6 9 |
50
+
| 9 3 6 | 8 4 5 | 2 7 1 |
104
51
+-------+-------+-------+
105
-
| 2 3 8 | 1 9 7 | 5 4 6 |
106
-
| 9 7 4 | 5 6 2 | 3 1 8 |
107
-
| 1 6 5 | 4 3 8 | 9 2 7 |
52
+
| 6 5 7 | 2 9 8 | 1 3 4 |
53
+
| 8 9 3 | 1 6 4 | 5 2 7 |
54
+
| 4 1 2 | 7 5 3 | 6 9 8 |
108
55
+-------+-------+-------+
109
-
| 3 1 9 | 6 8 4 | 7 5 2 |
110
-
| 5 2 7 | 9 1 3 | 6 8 4 |
111
-
| 4 8 6 | 7 2 5 | 1 9 3 |
56
+
| 3 6 5 | 4 8 9 | 7 1 2 |
57
+
| 7 8 1 | 6 3 2 | 9 4 5 |
58
+
| 2 4 9 | 5 7 1 | 3 8 6 |
112
59
+-------+-------+-------+
113
60
114
-
Runtime: 0.026 Seconds
115
-
Press q to quit
61
+
Execution time: 0.000593 s
116
62
```
117
-
##License
118
-
This is published under GPL version 3. See the `LICENSE` for details.
63
+
##License
64
+
This is published under GPL version 3. See the [`LICENSE`](LICENSE) for details.
0 commit comments