Skip to content

Commit e9b61e9

Browse files
committed
Added sudoku solver challenge
1 parent ab162a6 commit e9b61e9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

09-sudoku/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ These are some additional coding challenges to sharpen your Python programming s
1111
0. [A Grep Clone](https://github.com/PDXPythonPirates/code-challenges/tree/master/06-pygrep/)
1212
0. [Connect Four](https://github.com/PDXPythonPirates/code-challenges/tree/master/07-connect-four/)
1313
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/)
1415

1516

1617
## How to Contribute

0 commit comments

Comments
 (0)