This project focuses on generating valid Sodukos and solve them through recussion and the backtracking algorithm.
Sudoku is a puzzle game in which missing numbers are speard throughout a 9 X 9 grid. The grid contains rows, columns, and smaller 3 X 3 grids; each of these may only contain numbers 1 - 9 with no duplications. The game is a logic based, combinational, number-placement puzzle.
The goal for this project was to create a Sudoku board with no third-party libraries and solve it using the backtracking recursive alorithm. The application is ran through the console.
Backtracking is a general algorithm for solving recusrive problems. It focuses on building solutions incrementally and omitting the solutions that fail. In terms of Sudoku, the algorithm will attempt to place a number in each box one at a time, ensuring it is valid, and moving to the next box. If a number place does not work, it will recall the path it took and change to satify the conditions.
With no thrid-party libraries it is easy to execute. Ensure Python3 is downloaded, obtain a release copy of the code and execute!
Executing is simple and easy:
- Download the release
- Navigate to the Executable folder
- run
Python main.py
The application focues on three main methods:
<Board>.print(<board>)
Prints the board to the console. Empty places are noted with a.
.<Board>.generate(<board>, <difficulty>
Generates a valid empty board. The difficulty spans from 0 - 2; 0 being easy.<Board>.solve(<board>)
Solves the board using backtracking.
Contributors' names and contact info
Gavin Abeele @GitHub @LinkedIn
- 1.0
- See commit change or See release history
- Initial Release
This project is licensed under the Gavin Abeele License - see the LICENSE.MD file for details
Inspiration, code snippets, etc.