Next / Previous / Contents / Shipman's homepage

6.7. solutionFound(): The observer callback for solutions

This function is called by the SudokuSolver instance whenever it finds a solution to a puzzle.

sudoku
# - - -   s o l u t i o n F o u n d   - - -

def solutionFound ( solver ):
    """Report a successful solution of the puzzle.

      [ sys.stdout  +:=  display of the state of solver ]
    """
    print "\n--- Solution #%d:" % solver.nSolutions
    solver.write ( sys.stdout )