Skip to content

I wanted to test the performance of two methods of solving Sudoku puzzles, so I wrote some quick code for both.

Notifications You must be signed in to change notification settings

eloucks/Sudoku-Solvers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Sudoku-Solvers

I wanted to test the performance of two methods of solving Sudoku puzzles, so I wrote some quick code for both.

The first method I test is the standard approach: backtrack through possible combinations until you find one that works. Essentially, cleverer bruteforcing. This package is names SudokuStd

The second method I test is more like the human approach to solving. It still uses backtracking, but instead of testing every possible entry for the square it is on, it instead passes a "possible values" object with the puzzle that tracks what values are allowable by removing possibilities as numbers are placed. Obviously, this method is less memory efficient, but I wanted to see if removing the need to check the next value to be placed increased performance. Spoilers: it didn't. It turns out the process of removing a single number from several lists (corresponding to possible values for particular squares) takes more time than simply checking each number for every square.

About

I wanted to test the performance of two methods of solving Sudoku puzzles, so I wrote some quick code for both.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages