Skip to content

A crook's algorithm based sudoku solver written in rust

Notifications You must be signed in to change notification settings

bismitpanda/sudoku_solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoku Solver

This is an implementation of a sudoku solver using the Crook's Algorithm written in rust.

Features

It can solve every level of sudoku puzzle.

It first attempts to solve without using guessing by using forced cells and then applying preemptive sets as per the paper.

If it cannot be solved and requires gussing, the puzzle is solved using backtracking (commonly known as brute-forcing).

Usage

To run it locally, run

git clone https://github.com/blood-rogue/sudoku_solver.git
cd sudoku_solver

cargo r -r

Then provide the entire board as one line.

Note: I used . in the example for blanks but you can use any character other than 1 to 9 for blank spaces

Example

Testing

It is tested on 5 levels with 100 challenges each

  • easy
  • medium
  • hard
  • expert
  • evil

You can run all tests by running (You need to clone it first)

$ cargo test

Or can run the test individually for each difficulty by running

# Replace <difficulty> with one of the above levels
$ cargo test test_<difficulty>

You can find the test puzzles in the test/puzzles directory.

Inspirations

Note: The link to Damien's blog seems to be broken. web archive

About

A crook's algorithm based sudoku solver written in rust

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages