https://github.com/phmatray/sudokusolver
A Sudoku puzzle solver based on Hexagonal Architecture and written in C#. The application uses Google's OR-Tools for the solution process.
https://github.com/phmatray/sudokusolver
Last synced: 10 months ago
JSON representation
A Sudoku puzzle solver based on Hexagonal Architecture and written in C#. The application uses Google's OR-Tools for the solution process.
- Host: GitHub
- URL: https://github.com/phmatray/sudokusolver
- Owner: phmatray
- License: mit
- Created: 2023-07-20T13:49:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T15:23:34.000Z (about 2 years ago)
- Last Synced: 2025-02-01T07:27:54.995Z (12 months ago)
- Language: C#
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🧩 Sudoku Solver
A Sudoku puzzle solver based on Hexagonal Architecture and written in C#. The application uses Google's OR-Tools for the solution process.
## 🚀 Getting Started
### Prerequisites
The project is built in C#, so you need:
* .NET 8+ SDK
The project uses Google OR-Tools library for solving Sudoku puzzles. To install it, run:
```csharp
dotnet add package Google.OrTools
```
### Running the Project
Clone the repository and navigate to the directory of the solution file (.sln). Run the project using:
You will see the solution printed to the console.
```shell
dotnet run
```
## 🧠 How It Works
The project uses the Constraint Programming (CP) model, which is a powerful tool to solve combinatorial problems - in this case, Sudoku.
We represent the Sudoku board as a 2D array of integer variables. Each of these variables can hold an integer between 1 and 9.
We then add constraints:
* All numbers in a row must be different
* All numbers in a column must be different
* All numbers in a 3x3 grid must be different
* The values already filled in the Sudoku puzzle
The Google OR-Tools CP solver will try to find a solution that satisfies all these constraints.
If a solution is found, it is printed to the console. If no solution is found, the program prints a message stating that no solution was found.
## 🌟 Features
* Ability to solve any standard 9x9 Sudoku puzzle.
* Uses Google OR-Tools for solving the puzzles, ensuring an efficient solution.
* Clean and maintainable codebase following Hexagonal Architecture.
## 📈 Future Improvements
* Adding more interfaces to interact with the application (like a GUI, Web API, etc.)
* Extending the application to support different sizes of Sudoku puzzles.
## 🤝 Contributing
Contributions are always welcome. Please feel free to open an issue or submit a pull request with your changes or improvements.
## 📜 License
This project is open-source and available under the MIT License.