Metadata-Version: 2.4
Name: sudoku-board-solver-em
Version: 0.0.1
Summary: Sudoku solver
Home-page: https://github.com/emagri/sudoku
Author: Emilio Magri
Author-email: emilio.magri@gmail.com
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastcore
Requires-Dist: pandas
Requires-Dist: numpy
Provides-Extra: dev
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# sudoku


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Developer Guide

If you are new to using `nbdev` here are some useful pointers to get you
started.

### Install sudoku in Development mode

``` sh
# make sure sudoku package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to sudoku
$ nbdev_prepare
```

## Usage

### Installation

Install latest from the GitHub
[repository](https://github.com/emagri/sudoku):

``` sh
$ pip install git+https://github.com/emagri/sudoku.git
```

or from [conda](https://anaconda.org/emagri/sudoku)

``` sh
$ conda install -c emagri sudoku
```

or from [pypi](https://pypi.org/project/sudoku/)

``` sh
$ pip install sudoku
```

### Documentation

Documentation can be found hosted on this GitHub
[repository](https://github.com/emagri/sudoku)’s
[pages](https://emagri.github.io/sudoku/). Additionally you can find
package manager specific guidelines on
[conda](https://anaconda.org/emagri/sudoku) and
[pypi](https://pypi.org/project/sudoku/) respectively.

## How to use

Instantiate a
[`sudoku.board.Board`](https://emagri.github.io/sudoku/board.html#board)
class, passing it a list of 9 rows containing the initial Sudoku puzzle.

``` python
board = ['8-----41-', 
         '-6-9-----', 
         '3-2------', 
         '-5---814-', 
         '4----1--3', 
         '-8---326-', 
         '1-9------', 
         '-7-3-----', 
         '2-----85-']
```

Invoking its method `solve`, you can get a log of the processing and the
final result.

``` python
b = Board(board)
b.solve(False)
```

     |0-----------|1-----------|2-----------|3-----------|4-----------|5-----------|6-----------|7-----------|8-----------|
    0| 8          | 9          | 5          |   -2---6---| 3          | 7          | 4          | 1          |   -2---6---|
    1| 7          | 6          | 4          | 9          | 1          |   -2--5----|   --3-5----|   -23------| 8          |
    2| 3          | 1          | 2          |   ---456-8-|   ---456-8-|   ---456---|   ----567-9|   ------7-9|   ----5---9|
    3| 6          | 5          | 3          |   -2----7--|   -2------9| 8          | 1          | 4          |   ------7-9|
    4| 4          | 2          | 7          |   ----56---|   ----56--9| 1          |   ----5---9| 8          | 3          |
    5| 9          | 8          | 1          |   ---45-7--|   ---45----| 3          | 2          | 6          |   ----5-7--|
    6| 1          | 4          | 9          |   -2--56-8-|   -2--56-8-|   -2--56---|   --3---7--|   --3---7--|   -2---6---|
    7| 5          | 7          | 8          | 3          |   -2-4-6---|   -2-4-6---|   -----6--9|   -2------9| 1          |
    8| 2          | 3          | 6          | 1          | 7          | 9          | 8          | 5          | 4          |
     |0-----------|1-----------|2-----------|3-----------|4-----------|5-----------|6-----------|7-----------|8-----------|

    <Solution.NOT_FOUND: 'solution not found'>

The parameter `use_brute_force` (disabled by default) enables the use of
brute force in case attemps based on logic are not enough to solve the
puzzle.

``` python
b = Board(board)
b.solve(True)
```

     |0--|1--|2--|3--|4--|5--|6--|7--|8--|
    0| 8 | 9 | 5 | 2 | 3 | 7 | 4 | 1 | 6 |
    1| 7 | 6 | 4 | 9 | 1 | 5 | 3 | 2 | 8 |
    2| 3 | 1 | 2 | 8 | 6 | 4 | 9 | 7 | 5 |
    3| 6 | 5 | 3 | 7 | 2 | 8 | 1 | 4 | 9 |
    4| 4 | 2 | 7 | 6 | 9 | 1 | 5 | 8 | 3 |
    5| 9 | 8 | 1 | 4 | 5 | 3 | 2 | 6 | 7 |
    6| 1 | 4 | 9 | 5 | 8 | 6 | 7 | 3 | 2 |
    7| 5 | 7 | 8 | 3 | 4 | 2 | 6 | 9 | 1 |
    8| 2 | 3 | 6 | 1 | 7 | 9 | 8 | 5 | 4 |
     |0--|1--|2--|3--|4--|5--|6--|7--|8--|

    <Solution.ONE_SOLUTION: 'found a solution'>
