Sudoku: Difference between revisions

Content added Content deleted
m (Added space to subsection headline.)
m (updated header to match formatting rules)
Line 10,081: Line 10,081:
=={{header|Python}}==
=={{header|Python}}==
See [http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/python/sudoku/ Solving Sudoku puzzles with Python] for GPL'd solvers of increasing complexity of algorithm.
See [http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/python/sudoku/ Solving Sudoku puzzles with Python] for GPL'd solvers of increasing complexity of algorithm.

===Backtrack===


A simple backtrack algorithm -- Quick but may take longer if the grid had been more than 9 x 9
A simple backtrack algorithm -- Quick but may take longer if the grid had been more than 9 x 9
Line 10,169: Line 10,171:
</syntaxhighlight>
</syntaxhighlight>


'''Search + Wave Function Collapse'''
===Search + Wave Function Collapse===


A Sudoku solver using search guided by the principles of wave function collapse.
A Sudoku solver using search guided by the principles of wave function collapse.
Line 10,231: Line 10,233:
# [6, 4, 9, 1, 8, 2, 5, 7, 3]
# [6, 4, 9, 1, 8, 2, 5, 7, 3]
# [5, 2, 7, 4, 6, 3, 1, 9, 8]
# [5, 2, 7, 4, 6, 3, 1, 9, 8]

This solver found the 45 unknown values in 45 steps.


</syntaxhighlight>
</syntaxhighlight>