o
odin.langpkg.dev
packages / library / sudoku-solver

sudoku-solver

d9b717blibrary

No description provided.

No license · updated 6 months ago

Simple program for solving sudoku

Implemented in Odin using Raylib for the UI.

Makes use of the wave function collapse algorithm to solve provided sudoku puzzles.

Example solve on the hardest sudoku I could find on sudokuoftheday.com

sudoku_solver.webm

Dark colored numbers represent values that are set (either by hand before running the program or by the algorithm)

Grey numbers represent how many possible states a cell has at that moment

When a grey number goes down to zero it turns red to represent an invalid state (a cell cannot have zero possible values in a correctly made sudoku)

After encountering an invalid state program backtracks to the last choice it made and tries to pick a different path

Dependencies

  • Odin compiler
  • Raylib

If you have nix installed on your system then all dependencies can be installed from the provided flake.nix file. To do so just run nix develop in the project directory.

How to run

After cloning the repository run odin run . in the project directory to run the program or odin build . to build it.

After the application starts you will be able to input values by hovering your mouse over the desired cell and pressing one of the number keys on your keyboard.

After you inputting starting values you can press the space key to run the solver