A Python package to create a pair of solve and unsolve sudoku.
Project description
A Python Package To Create A Pair Of Solve And Unsolve Sudoku.
Usage
Import Sudoku In You Code As
from sudoku import *
There Are Two Method.
- create()
- display()
1. create()
Method create()
Take level As A Input Parameter.
level Should As
- easy
- medium
- hard
- extreme
And Return A Two Variable Unsolve Sudoku And Solve Sudoku
Puzzle, Solution = create('easy')
print(Puzzle)
[[0, 3, 0, 6, 5, 1, 0, 4, 7],
[6, 0, 1, 2, 4, 0, 9, 3, 0],
[2, 4, 7, 9, 3, 8, 0, 0, 0],
[0, 9, 3, 0, 6, 0, 1, 2, 4],
[0, 6, 5, 1, 0, 0, 7, 9, 3],
[1, 2, 4, 0, 9, 3, 0, 0, 5],
[4, 0, 9, 3, 0, 6, 5, 1, 0],
[0, 8, 6, 0, 1, 2, 4, 0, 9],
[5, 1, 0, 4, 7, 9, 0, 8, 0]]
print(Solution)
[[9, 3, 8, 6, 5, 1, 2, 4, 7],
[6, 5, 1, 2, 4, 7, 9, 3, 8],
[2, 4, 7, 9, 3, 8, 6, 5, 1],
[7, 9, 3, 8, 6, 5, 1, 2, 4],
[8, 6, 5, 1, 2, 4, 7, 9, 3],
[1, 2, 4, 7, 9, 3, 8, 6, 5],
[4, 7, 9, 3, 8, 6, 5, 1, 2],
[3, 8, 6, 5, 1, 2, 4, 7, 9],
[5, 1, 2, 4, 7, 9, 3, 8, 6]]
Here Puzzle Is Unsolve Sudoku In Form Of Matrix. And Solution Is Solve Sudoku Of Puzzle.
2. display()
Method display()
Take Sudoku As A Input Parameter. Which Chould Be Solve Or Unsolve.
Display Puzzle
display(Puzzle)
Output:
* - - - | - - - | - - - *
| 0 3 0 | 6 5 1 | 0 4 7 |
| 6 0 1 | 2 4 0 | 9 3 0 |
| 2 4 7 | 9 3 8 | 0 0 0 |
| - - - | - - - | - - - |
| 0 9 3 | 0 6 0 | 1 2 4 |
| 0 6 5 | 1 0 0 | 7 9 3 |
| 1 2 4 | 0 9 3 | 0 0 5 |
| - - - | - - - | - - - |
| 4 0 9 | 3 0 6 | 5 1 0 |
| 0 8 6 | 0 1 2 | 4 0 9 |
| 5 1 0 | 4 7 9 | 0 8 0 |
* - - - | - - - | - - - *
Display Solution
display(Solution)
Output
* - - - | - - - | - - - *
| 9 3 8 | 6 5 1 | 2 4 7 |
| 6 5 1 | 2 4 7 | 9 3 8 |
| 2 4 7 | 9 3 8 | 6 5 1 |
| - - - | - - - | - - - |
| 7 9 3 | 8 6 5 | 1 2 4 |
| 8 6 5 | 1 2 4 | 7 9 3 |
| 1 2 4 | 7 9 3 | 8 6 5 |
| - - - | - - - | - - - |
| 4 7 9 | 3 8 6 | 5 1 2 |
| 3 8 6 | 5 1 2 | 4 7 9 |
| 5 1 2 | 4 7 9 | 3 8 6 |
* - - - | - - - | - - - *
Source Code Github
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sudoku-create-0.0.1.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for sudoku_create-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df7ce1e4a9dbc25a8c7a98a89ba60e5e28dc2374470be210b21a25909d071416 |
|
MD5 | f2e63e58b6407fdb8e31864f741b3225 |
|
BLAKE2b-256 | d6c9c520cecdb97483e67d1147e2d3e0213e8f09970de2600634250531f1a547 |