Skip to main content

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.

  1. create()
  2. 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


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)

Uploaded Source

Built Distribution

sudoku_create-0.0.1-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page