将python代码复制到同一个目录,比如C:\d\ac3, 然后用如下命令行运行
C:\d\ac3>python driver.py
Would you like to use a preloaded Sudoku board?: (y/n)y
Choose one of the following levels:
[1] No Solution
[2] Easy
[3] Medium
[4] Hard
[5] Hardest in the World
Please input the level of difficulty: 1
8 - - |- - - |- - -
- - 3 |6 - - |- - -
- 7 - |- 9 - |2 - -
-------------------
- 5 - |- - 7 |- - -
- - - |- 4 5 |7 - -
- - - |1 - - |- 3 -
-------------------
- - 1 |- - - |- 6 8
- - 8 |5 - - |- 1 -
- 9 9 |9 9 9 |9 9 9
Error: There is no solution to this sudoku puzzle
C:\d\ac3>python driver.py
Would you like to use a preloaded Sudoku board?: (y/n)y
Choose one of the following levels:
[1] No Solution
[2] Easy
[3] Medium
[4] Hard
[5] Hardest in the World
Please input the level of difficulty: 5
8 - - |- - - |- - -
- - 3 |6 - - |- - -
- 7 - |- 9 - |2 - -
-------------------
- 5 - |- - 7 |- - -
- - - |- 4 5 |7 - -
- - - |1 - - |- 3 -
-------------------
- - 1 |- - - |- 6 8
- - 8 |5 - - |- 1 -
- 9 - |- - - |4 - -
8 1 2 |7 5 3 |6 4 9
9 4 3 |6 8 2 |1 7 5
6 7 5 |4 9 1 |2 8 3
-------------------
1 5 4 |2 3 7 |8 9 6
3 6 9 |8 4 5 |7 2 1
2 8 7 |1 6 9 |5 3 4
-------------------
5 2 1 |9 7 4 |3 6 8
4 3 8 |5 2 6 |9 1 7
7 9 6 |3 1 8 |4 5 2
Solve Time: 0.7645819187164307 seconds
C:\d\ac3>python driver.py
Would you like to use a preloaded Sudoku board?: (y/n)y
Choose one of the following levels:
[1] No Solution
[2] Easy
[3] Medium
[4] Hard
[5] Hardest in the World
Please input the level of difficulty: 4
- 7 - |- 4 2 |- - -
- - - |- - 8 |6 1 -
3 9 - |- - - |- - 7
-------------------
- - - |- - 4 |- - 9
- - 3 |- - - |7 - -
5 - - |1 - - |- - -
-------------------
8 - - |- - - |- 7 6
- 5 4 |8 - - |- - -
- - - |6 1 - |- 5 -
1 7 6 |3 4 2 |9 8 5
4 2 5 |9 7 8 |6 1 3
3 9 8 |5 6 1 |4 2 7
-------------------
2 6 1 |7 8 4 |5 3 9
9 8 3 |2 5 6 |7 4 1
5 4 7 |1 9 3 |2 6 8
-------------------
8 1 9 |4 2 5 |3 7 6
6 5 4 |8 3 7 |1 9 2
7 3 2 |6 1 9 |8 5 4
Solve Time: 0.1383507251739502 seconds
C:\d\ac3>python driver.py
Would you like to use a preloaded Sudoku board?: (y/n)y
Choose one of the following levels:
[1] No Solution
[2] Easy
[3] Medium
[4] Hard
[5] Hardest in the World
Please input the level of difficulty: 3
- - - |5 4 - |- - 8
6 - - |- - 2 |3 - -
- - 7 |- - 3 |- 9 -
-------------------
- 3 1 |- 5 - |- 2 -
- - - |- - - |- - -
- 4 - |- 3 - |7 1 -
-------------------
- 9 - |7 - - |2 - -
- - 8 |6 - - |- - 5
1 - - |- 2 4 |- - -
2 1 3 |5 4 9 |6 7 8
6 8 9 |1 7 2 |3 5 4
4 5 7 |8 6 3 |1 9 2
-------------------
9 3 1 |4 5 7 |8 2 6
8 7 2 |9 1 6 |5 4 3
5 4 6 |2 3 8 |7 1 9
-------------------
3 9 4 |7 8 5 |2 6 1
7 2 8 |6 9 1 |4 3 5
1 6 5 |3 2 4 |9 8 7
Solve Time: 0.02900862693786621 seconds
C:\d\ac3>