-
Which sudoku puzzle would you like the computer to solve? 1 | 2 | 3 | 4 | 5 | 6 (To see preview of a puzzle, enter 'p'. To quit, enter 'q'.)
You have 3 options here (Solve, Preview, or Quit):
-
Enter a Puzzle Number
- Options: 1 , 2 , 3 , 4 , 5 , and 6
- Proceed to Solving the Puzzle
-
(Enter
p
[not case sensitive] to preview a puzzle.)p
-
If preview is chosen, a follow up prompt will appear:
Which puzzle which you like to preview? 1 | 2 | 3 | 4 | 5 | 6 ?
-
Enter a choice (1 , 2 , 3 , 4 , 5 , or 6) from the above options.
1
-
The chosen puzzle (in this example,
1
) is printed to the terminalRow 1: ['0', '0', '3', '0', '0', '0', '0', '9', '0'] Row 2: ['0', '1', '0', '0', '7', '0', '2', '0', '4'] Row 3: ['4', '0', '0', '0', '0', '1', '0', '5', '0'] Row 4: ['0', '0', '0', '9', '0', '0', '3', '0', '0'] Row 5: ['0', '8', '0', '0', '1', '0', '0', '7', '0'] Row 6: ['0', '0', '6', '0', '0', '4', '0', '0', '0'] Row 7: ['0', '3', '0', '5', '0', '0', '0', '0', '7'] Row 8: ['9', '0', '5', '0', '8', '0', '0', '6', '0'] Row 9: ['0', '7', '0', '0', '0', '0', '4', '0', '0']
-
The original prompt will then reappear:
Which sudoku puzzle would you like the computer to solve? 1 | 2 | 3 | 4 | 5 | 6 (To see preview of a puzzle, enter 'p'. To quit, enter 'q'.)
Enter a puzzle number to solve the desired puzzle.
-
-
-
To quit, enter
q
into the command line.q
-
-
-
-
Once you've entered a puzzle number, the computer will solve the puzzle. In this example, the puzzle is Puzzle 1.
1 --------------------------------- --- S O L U T I O N --- --------------------------------- Row 1: ['2', '5', '3', '4', '6', '8', '1', '9', '0'] Row 2: ['6', '1', '8', '3', '7', '5', '2', '0', '4'] Row 3: ['4', '9', '7', '2', '0', '1', '6', '5', '3'] Row 4: ['1', '2', '4', '9', '5', '6', '3', '8', '0'] Row 5: ['3', '8', '9', '0', '1', '2', '5', '7', '6'] Row 6: ['5', '0', '6', '7', '3', '4', '9', '1', '2'] Row 7: ['8', '3', '1', '5', '2', '9', '0', '0', '7'] Row 8: ['9', '4', '5', '1', '8', '3', '0', '6', '0'] Row 9: ['0', '7', '2', '6', '0', '0', '4', '3', '1']
-
In addition to the attempted solution, the
cost
of each row is printed to the terminal. The higher the cost, the more elements need reassigned to achieve the true solution.--------------------------------- --- R O W C O S T S --- --------------------------------- Row 1 Cost: 1 Row 2 Cost: 1 Row 3 Cost: 1 Row 4 Cost: 1 Row 5 Cost: 1 Row 6 Cost: 1 Row 7 Cost: 2 Row 8 Cost: 2 Row 9 Cost: 3
-
Note: Zeros (0) are placeholders for empty cells
Row 1: ['0', '0', '3', '0', '0', '0', '0', '9', '0']
Row 2: ['0', '1', '0', '0', '7', '0', '2', '0', '4']
Row 3: ['4', '0', '0', '0', '0', '1', '0', '5', '0']
Row 4: ['0', '0', '0', '9', '0', '0', '3', '0', '0']
Row 5: ['0', '8', '0', '0', '1', '0', '0', '7', '0']
Row 6: ['0', '0', '6', '0', '0', '4', '0', '0', '0']
Row 7: ['0', '3', '0', '5', '0', '0', '0', '0', '7']
Row 8: ['9', '0', '5', '0', '8', '0', '0', '6', '0']
Row 9: ['0', '7', '0', '0', '0', '0', '4', '0', '0']
Row 1: ['1', '0', '8', '0', '2', '6', '0', '0', '0']
Row 2: ['3', '7', '0', '0', '1', '0', '0', '0', '0']
Row 3: ['0', '0', '2', '0', '0', '7', '0', '0', '0']
Row 4: ['0', '0', '0', '0', '0', '8', '0', '0', '5']
Row 5: ['0', '5', '0', '0', '0', '0', '0', '0', '7']
Row 6: ['0', '3', '6', '0', '0', '0', '0', '0', '0']
Row 7: ['0', '0', '0', '9', '0', '0', '0', '5', '3']
Row 8: ['0', '0', '0', '3', '0', '1', '7', '0', '0']
Row 9: ['7', '9', '0', '2', '0', '0', '0', '0', '8']
Row 1: ['0', '0', '0', '0', '0', '0', '0', '0', '1']
Row 2: ['9', '0', '1', '0', '0', '2', '0', '4', '3']
Row 3: ['0', '0', '0', '0', '0', '0', '9', '0', '0']
Row 4: ['0', '0', '0', '0', '5', '6', '0', '0', '2']
Row 5: ['0', '0', '0', '0', '1', '0', '0', '0', '0']
Row 6: ['0', '0', '0', '0', '0', '0', '4', '3', '5']
Row 7: ['1', '6', '0', '9', '8', '0', '0', '0', '0']
Row 8: ['0', '5', '4', '0', '0', '0', '8', '0', '9']
Row 9: ['0', '8', '0', '0', '0', '3', '0', '2', '0']
Row 1: ['0', '0', '0', '9', '0', '2', '8', '0', '0']
Row 2: ['0', '4', '9', '0', '0', '1', '0', '7', '0']
Row 3: ['7', '0', '0', '0', '0', '0', '0', '9', '0']
Row 4: ['3', '5', '0', '0', '9', '0', '7', '0', '0']
Row 5: ['0', '0', '0', '7', '0', '5', '0', '0', '0']
Row 6: ['0', '0', '2', '0', '3', '0', '0', '8', '4']
Row 7: ['0', '9', '0', '0', '0', '0', '0', '0', '3']
Row 8: ['0', '6', '0', '3', '0', '0', '9', '1', '0']
Row 9: ['0', '0', '5', '6', '0', '9', '0', '0', '0']
Row 1: ['0', '0', '8', '0', '0', '1', '5', '0', '0']
Row 2: ['7', '4', '0', '0', '8', '0', '0', '0', '2']
Row 3: ['6', '0', '0', '0', '0', '0', '0', '0', '0']
Row 4: ['0', '0', '0', '2', '0', '9', '1', '7', '0']
Row 5: ['0', '7', '0', '0', '0', '0', '0', '2', '0']
Row 6: ['0', '3', '1', '7', '0', '8', '0', '0', '0']
Row 7: ['0', '0', '0', '0', '0', '0', '0', '0', '5']
Row 8: ['4', '0', '0', '0', '3', '0', '0', '6', '1']
Row 9: ['0', '0', '3', '4', '0', '0', '9', '0', '0']
Row 1: ['8', '1', '0', '5', '2', '0', '0', '0', '0']
Row 2: ['0', '2', '0', '4', '3', '0', '0', '0', '9']
Row 3: ['0', '0', '4', '0', '0', '9', '0', '0', '0']
Row 4: ['0', '0', '0', '0', '0', '0', '6', '7', '5']
Row 5: ['0', '8', '0', '0', '0', '0', '0', '3', '0']
Row 6: ['9', '5', '3', '0', '0', '0', '0', '0', '0']
Row 7: ['0', '0', '0', '2', '0', '0', '3', '0', '0']
Row 8: ['7', '0', '0', '0', '5', '1', '0', '6', '0']
Row 9: ['0', '0', '0', '0', '6', '4', '0', '9', '8']
-
self.cells
- Type:
list
- Description: Contains a 9 x 9
list
oflists
that holds all of the puzzle's cells. Each of the 9lists
contain 9Cell
objects. Each of the 9 lists (of length 9) are the rows of the puzzle.
- Type:
-
self.filename
- Type:
str
- Description: File name of the
.csv
sudoku file used as input.
- Type:
-
self.rows
- Type:
list
- Description: 9 x 9
list
oflists
; Each of the 9lists
contain the values in the Puzzle's rows.
- Type:
-
self.columns
- Type:
list
- Description: 9 x 9
list
oflists
; Each of the 9lists
contain the values in the Puzzle's columns.
- Type:
-
self.value
- Type:
str
- Description: Contains the value of the cell.
- Type:
-
self.row
- Type:
list
- Description: 9 element
list
containing the row that theCell
object is within.
- Type:
-
self.col
- Type:
list
- Description: 9 element
list
containing the column that theCell
object is within.
- Type:
-
self.rows
- Type:
list
- Description: 9 x 9
list
oflists
. Each of the 9lists
contains the puzzle's rows.
- Type:
-
self.col_no
- Type:
int
- Description: Column number that the
Cell
object is located within.
- Type:
-
self.row_no
- Type:
int
- Description: Row number that the
Cell
object is located within.
- Type:
-
self.grid_location
-
Type:
int
-
Description: Grid number that the
Cell
object is located within. Grids are numbered as follows:Grid Numbering: |__1__||__2__||__3__| |__4__||__5__||__6__| |__7__||__8__||__9__|
-
-
self.fixed
- Type:
bool
- Description: Whether or not the cell value is fixed. If the value was given from the beginning, it is fixed.
- Type:
-
self.options
-
Type:
list
-
Description:
list
of options for the cell to choose from for guessing a solution;self.options = [1,2,3,4,5,6,7,8,9]
-
-
self.grid
- Type:
list
- Description: 9 element
list
containing the grid that theCell
object is within.
- Type: