sudoku
Input Format
1. Header Line [ROWS] [COLS]
2. Grid Lines (Remaining [ROW] lines) The initial state of the grid rows.
Legend:
* -: empty (to be filled) cells;
* 1-9: Pre-filled number.
Output Format
Returns the sudoku-variant grid as a matrix of numbers, [ROWS] by [COLS].
Legend:
- -: forbidden cells (no number);
- 1-9: filled number.
Examples
Python Quick Start
Use the following code to solve this puzzle directly:
import puzzlekit
# Raw input data
problem_str = """
9 9
2 1 - 4 - - - 3 6
8 - - - - - - - 5
- - 5 3 - 9 8 - -
6 - 4 9 - 7 1 - -
- - - - 3 - - - -
- - 7 5 - 4 6 - 2
- - 6 2 - 3 5 - -
5 - - - - - - - 9
9 3 - - - 5 - 2 7
"""
# Solve
res = puzzlekit.solve(problem_str, puzzle_type="sudoku")
# Print solution grid
print(res.solution_data.get('solution_grid', []))
# Visualize (optional)
res.show()