Metadata-Version: 2.4
Name: sudoku-engine
Version: 2.0.0
Summary: A simple Python package that generates and solves m x n Sudoku puzzles.
Author-email: Sepehr Rasouli <sepehrrasouli06@gmail.com>
License: MIT License
        
        Copyright (c) 2019 Jeff Sieu
        Copyright (c) 2025 Sepehr Rasouli
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/sepehr-rs/sudoku-engine
Project-URL: Issues, https://github.com/sepehr-rs/sudoku-engine/issues
Project-URL: GitHub, https://github.com/sepehr-rs/sudoku-engine/py-sudoku
Keywords: SUDOKU
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# sudoku-engine

A simple Python package that generates and solves m x n Sudoku puzzles. A modified version of [py-sudoku](https://github.com/jeffsieu/py-sudoku), Built by [jeffsieu](https://github.com/jeffsieu).
This library serves primarily as the backend for [Sudoku](https://flathub.org/apps/io.github.sepehr_rs.Sudoku), but can be used as a standalone Sudoku library.

## Install

```sh
# Python 3
pip3 install sudoku-engine
```
## Usage
### Classic Sudoku

```python
from sudoku import ClassicSudoku

puzzle = ClassicSudoku(size=9)
print("Puzzle:")
print(puzzle)

solution = puzzle.solve()
print("Solved:")
print(solution)
```

### Diagonal Sudoku

```python
from sudoku import DiagonalSudoku

puzzle = DiagonalSudoku(size=9)
solution = puzzle.solve()
```

### Generating Puzzles

```python
from sudoku.base_sudoku import PuzzleGenerator
from sudoku import ClassicSudoku

puzzle = PuzzleGenerator.make_puzzle(
    sudoku_cls=ClassicSudoku,
    size=9,
    difficulty=0.5,
    ensure_unique=True
)
print(puzzle)
```

If you wish to raise an `UnsolvableSudoku` error when the board is invalid pass a `raising=True` parameter:

```py
puzzle.solve(raising=True)
```
