Metadata-Version: 2.4
Name: sudoku_rust
Version: 1.0.3
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: ipykernel>=6.29.5
Requires-Dist: numpy>=1.24.4
Requires-Dist: pytest>=8.3.5
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# sudoku-rust

## Installation

```
pip install sudoku-rust
```

## Sample Python Code

```Python:sample.py
import sys
import time

import numpy as np
from sudoku_rust import __version__, check, solve
print(f"sudoku-rust{__version__}")

if len(sys.argv) == 1:
    print(f"usage: {sys.argv[0]} filename")
    exit()

filepath = sys.argv[1]
x = np.loadtxt(filepath, delimiter=",").astype(np.uint16)
print("Problem:")
print(x)

start = time.perf_counter()

try:
    y = solve(x)
except Exception as e:
    print(f"Error: {e}", file=sys.stderr)
    exit(1)

end = time.perf_counter()
elapsed = end - start

print("Solution:")
print(y)

print(f"elapsed time: {elapsed:.6f}")

if np.all(x == y):
    print("The problem doesn't have any solutions.", file=sys.stderr)
else:
    assert check(y), "Trouble has occurred."
    assert np.all((x == y) == (x != 0)), "Trouble has occurred."
```

## Sample Data (Sudoku Problem)

```easy.csv
1,3,0,7,9,0,0,4,5
0,0,5,0,0,0,0,0,6
2,0,0,0,8,0,9,0,0
3,1,0,4,6,5,8,0,0
4,0,0,0,0,0,0,0,2
0,0,7,9,3,2,0,1,4
0,0,3,0,7,0,0,0,8
7,0,0,0,0,0,3,0,0
8,9,0,0,5,4,0,2,1
```

