File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Challenge: Sudoku Solver
2
+
3
+ Write a program that reads in an unsolved [ sudoku puzzle] [ sudoku ] and prints the solved puzzle.
4
+
5
+ Unsolved locations in the puzzle are represented by ` _ ` .
6
+ The input may be read in from a file or STDIN (your choice).
7
+
8
+ Your program should print the solved puzzle in the same format but with the ` _ ` empty slots filled in.
9
+
10
+ Example input:
11
+
12
+ 1 _ 3 _ _ 6 _ 8 _
13
+ _ 5 _ _ 8 _ 1 2 _
14
+ 7 _ 9 1 _ 3 _ 5 6
15
+ _ 3 _ _ 6 7 _ 9 _
16
+ 5 _ 7 8 _ _ _ 3 _
17
+ 8 _ 1 _ 3 _ 5 _ 7
18
+ _ 4 _ _ 7 8 _ 1 _
19
+ 6 _ 8 _ _ 2 _ 4 _
20
+ _ 1 2 _ 4 5 _ 7 8
21
+
22
+ Example solution:
23
+
24
+ 1 2 3 4 5 6 7 8 9
25
+ 4 5 6 7 8 9 1 2 3
26
+ 7 8 9 1 2 3 4 5 6
27
+ 2 3 4 5 6 7 8 9 1
28
+ 5 6 7 8 9 1 2 3 4
29
+ 8 9 1 2 3 4 5 6 7
30
+ 3 4 5 6 7 8 9 1 2
31
+ 6 7 8 9 1 2 3 4 5
32
+ 9 1 2 3 4 5 6 7 8
33
+
34
+ This is a problem that can be solved using exhaustive brute force or more sophisticated rules and data handling. How you go about it is up to you! :-)
35
+
36
+ * This challenge is shamelessly stolen from a [ similar challenge] [ golang_challenge ] in the Go community.*
37
+
38
+ [ sudoku ] : https://en.wikipedia.org/wiki/Sudoku
39
+ [ golang_challenge ] : http://golang-challenge.org/go-challenge8/
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ These are some additional coding challenges to sharpen your Python programming s
11
11
0 . [ A Grep Clone] ( https://github.com/PDXPythonPirates/code-challenges/tree/master/06-pygrep/ )
12
12
0 . [ Connect Four] ( https://github.com/PDXPythonPirates/code-challenges/tree/master/07-connect-four/ )
13
13
0 . [ Check the Weather] ( https://github.com/PDXPythonPirates/code-challenges/tree/master/08-weather-check/ )
14
+ 0 . [ Sudoku Solver] ( https://github.com/PDXPythonPirates/code-challenges/tree/master/09-sudoku/ )
14
15
15
16
16
17
## How to Contribute
You can’t perform that action at this time.
0 commit comments