Skip to content

Sudoku game and solver using backtracking algorithm.

License

Notifications You must be signed in to change notification settings

sk8thing/sudoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Sudoku game and solver made using SDL2 library and backtracking for the sudoku generator/solver part.

Running the game

Start by cloning the repository

git clone https://github.com/sk8thing/sudoku.git

Download the executable from the release tab and put it inside the /bin folder, next to the required dlls. If you want to compile it yourself I suggest using the CMake scripts inside the /cmake folder along with the CMakeLists example. After all that you can run the executable

./path/to/bin/sudoku.exe

Controls

ARROW_UP/DOWN/LEFT/RIGHT - move cursor
1-9 - set value
RCTRL - clear value
RSHIFT - resets the board and generates a new one
RALT - solves the sudoku

Backtracking

In order to generate/solve the sudoku a backtracking algorithm is used. The algorithm goes through every single possible candidate to the solution and checks whether it leads to a valid solution or not. If it doesn't, then it gets eliminated and the algorithm goes back and checks the rest of the candidates. After generating a valid sudoku board, a random number of values is removed from it.

Screenshots

1 2 3