Skip to content

solvertools

Module providing the core tools to build and interact with a Sudoku solver.

generate_solver(method_order, stepper) #

Build a Sudoku solver by deciding in what order the solving methods (i.e. the instances of FmtSolvingMethod classes) are chained together. The order of the method_order array implies that after the failure of the n-th method, the n+1-th method will be used. On the other hand, at success of the n-th method, the solver will proceed by calling the 1st element of method_order. Moreover, any StepperBase object must be provided to guide the user through the solving process.

Parameters:

Name Type Description Default
method_order Tuple[FmtSolvingMethod]

Solving Algorithm objects in their preferred order

required
stepper StepperBase

The Stepping object used by the Solver

required

Returns:

Type Description
FmtSolvingMethod

The Solver

load(path) #

Load a Sudoku puzzle stored as csv file at path and build a Sudoku structure form the tow-dimensional grid.

Parameters:

Name Type Description Default
path Path

The path to the .csv file

required

Returns:

Type Description
Sudoku

The Puzzle in its initial shape

save(sudoku, path) #

Write the solved sudoku puzzle to a csv file at path

Parameters:

Name Type Description Default
sudoku Sudoku

The puzzle to save

required
path Path

.csv file to write to

required