Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonas-is-coding/sudoku-bruteforce
A Sudoku solver via brute forcing in C++
https://github.com/jonas-is-coding/sudoku-bruteforce
brute-force cpp solver sudoku
Last synced: 25 days ago
JSON representation
A Sudoku solver via brute forcing in C++
- Host: GitHub
- URL: https://github.com/jonas-is-coding/sudoku-bruteforce
- Owner: jonas-is-coding
- Created: 2024-11-07T21:51:17.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-17T12:11:34.000Z (about 2 months ago)
- Last Synced: 2024-11-17T13:20:28.246Z (about 2 months ago)
- Topics: brute-force, cpp, solver, sudoku
- Language: C++
- Homepage: https://www.jonasbrahmst.me/blog/create-a-sudoku-bruteforcing-script-in-cpp
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sudoku Brute Forcer
This project implements a Sudoku solver via brute forcing in C++. The solver can solve any given Sudoku puzzle, with varying difficulty levels.
## Inspiration
This project was inspired by a [YouTube Shorts video](https://www.youtube.com/watch?app=desktop&v=4c_16yiQBfI). Later, I wrote a [blog article](https://www.jonasbrahmst.me/blog/create-a-sudoku-bruteforcing-script-in-cpp) explaining how I implemented the solver and the steps I took to build it. Feel free to check out both resources for a more detailed explanation!
## Requirements
- C++11 or later
- A C++ compiler (e.g., `g++`)## Installation
1. Clone this repository:
```bash
git clone https://github.com/jonas-is-coding/sudoku-solver.git
```
2. Navigate to the project directory:
```bash
cd sudoku-solver
```
3. Compile the project using g++:
```bash
g++ -std=c++11 -O2 main.cpp -o sudoku-solver
```
4. Run the executable:
```bash
./sudoku-solver
```## Usage
1. Generating a Sudoku Puzzle: The program generates a new Sudoku puzzle based on the specified fill percentage, where a higher percentage means an easier puzzle.
2. Solving a Sudoku Puzzle: If a Sudoku puzzle is provided as input, the program will solve it using a backtracking algorithm.## File Structure
- main.cpp: Main entry point of the application.
- solve.hpp and solve.cpp: Contains the logic for solving the Sudoku puzzle.
- generate.hpp and generate.cpp: Contains the logic for generating Sudoku puzzles.
- check.hpp: Contains the validation functions for checking whether a Sudoku puzzle is valid.
- types.hpp: Defines the board structure (board_t), a 9x9 matrix representing the Sudoku grid.