semvec/pypi-packages huggingface dataset:
python-sudoku 1.0
Package for creating Sudoku applications
Requires Python: >=3.6

# SudokuField

`SudokuField` is a Python class for managing and solving Sudoku puzzles of various sizes.

## Import

To use `python-sudoku`, download the `python-sudoku.py` file and import the class into your project:

```python
from python-sudoku import SudokuField
```

## Example
```python
from python-sudoku import SudokuField

# Create a standard Sudoku
sudoku = SudokuField(size="standard")

# Clear the Sudoku field (initialize with an empty field)
sudoku.clear()

# Print the empty field
sudoku.print()

# Set a Sudoku field
sudoku.set([
    [5, 3, 0, 0, 7, 0, 0, 0, 0],
    [6, 0, 0, 1, 9, 5, 0, 0, 0],
    [0, 9, 8, 0, 0, 0, 0, 6, 0],
    [8, 0, 0, 0, 6, 0, 0, 0, 3],
    [4, 0, 0, 8, 0, 3, 0, 0, 1],
    [7, 0, 0, 0, 2, 0, 0, 0, 6],
    [0, 6, 0, 0, 0, 0, 2, 8, 0],
    [0, 0, 0, 4, 1, 9, 0, 0, 5],
    [0, 0, 0, 0, 8, 0, 0, 7, 9]
])

# Print the current field
sudoku.print()

# Check if the Sudoku is valid
if sudoku.is_valid():
    print("The Sudoku is valid.")

# Solve the Sudoku
solution = sudoku.solution()
if solution:
    print("Solution found:")
    solution.print()
else:
    print("No solution found.")

# Check if the solution is unique
if sudoku.has_unique_solution():
    print("The Sudoku has a unique solution.")
else:
    print("The Sudoku does not have a unique solution.")
```