Opener
Opener is a puzzle solver Python package. Currently it solves the Open the lock puzzle. The package can be found in the Python Package Index (PyPI).
This package can be used on Linux/Unix, Mac OS and Windows systems.
Features
- Get keys for Open the lock puzzle.
Installation
You can install the opener from PyPI:
pip install opener
The opener is supported on Python 2.7, as well as Python 3.4 and above.
How to use
Example 1
The above figure outlines a three digits Open the Lock puzzle. A valid unlock key of the above puzzle is: 679
example_1.py shows how to use opener package to solve the above puzzle.
Solution of the above Open the lock puzzle:
from opener import get_keys
number_of_positions = 3
invalid_digits = (5, 2, 3)
similarity_conditions = (
([9, 6, 4], 2),
([2, 8, 6], 1),
([1, 4, 7], 1),
([1, 8, 9], 1)
)
invalid_positioned_values = ((9, 1), (6, 8, 4), (4, 6, 7))
valid_positioned_values = ((1,), (8,), (9,))
unlock_keys = get_keys(number_of_positions,
similarity_conditions,
invalid_digits,
invalid_positioned_values,
valid_positioned_values)
for key in unlock_keys:
print(key)
# 679
Example 2
The above figure outlines another Open the Lock puzzle with four digits combination. A valid unlock key of the above puzzle is: 9876
example_2.py shows how to use opener package to solve the above puzzle.
Solution of the above Open the lock puzzle:
from opener import get_keys
number_of_positions = 4
invalid_digits = (5, 1, 2, 4)
similarity_conditions = (
([3, 5, 4, 8], 1),
([4, 6, 7, 1], 2),
([3, 7, 8, 1], 2),
([8, 3, 9, 7], 3),
([2, 9, 3, 4], 1),
([5, 1, 3, 6], 1),
)
invalid_positioned_values = ((3, 8, 2), (5, 7, 3, 9),
(4, 8, 9, 3), (8, 1, 7, 4))
valid_positioned_values = ((5,), (1,), (3,), (6,))
unlock_keys = get_keys(number_of_positions,
similarity_conditions,
invalid_digits,
invalid_positioned_values,
valid_positioned_values)
for key in unlock_keys:
print(key)
# 9876
Authors
- Maintainer: Ahmedur Rahman Shovon
- Please see the list of contributors to find the contributors of this project.
Contribute
Contributions are welcome from the community. Questions can be asked on the
issues page. Before creating a new issue, please take a moment to search
and make sure a similar issue does not already exist. If one does exist, you
can comment (most simply even with just a :+1:) to show your support for that
issue.
If you have direct contributions you would like considered for incorporation into the project you can fork this repository and submit a pull request for review.
Please read the development guideline before contribution.
Changelog
0.0.3 (2020-10-03)
- Added four digits open the lock example
- Updated tests
- Updated readme
- Separated development guideline
- Added pylint and flake8
0.0.2 (2020-10-02)
- Release to PyPI
0.0.1 (2020-10-01)
- Initial release
Metadata
Release files for opener 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opener-0.0.4.tar.gz | 139.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opener-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 144.3 kB
Release files / opener-0.0.4.tar.gz
| Download URL | opener-0.0.4.tar.gz |
|---|---|
| Size | 139.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
baaede37dd57bc8507f94acc55b12c3ad879d31d6e8c3c3ad2351f65ad4566b5
|
|
BLAKE2b-256 checksum How to use checksums |
eb95c0bd87472b27692fd71ce8d440311d3d11f4ae1e59e73bfc95ce457170d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.9
|
Release files / opener-0.0.4-py3-none-any.whl
| Download URL | opener-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df17ad69f3c990cc0fd6be1497465c5d449a641bc68b7f9feca4bdbe5dbc1bfe
|
|
BLAKE2b-256 checksum How to use checksums |
8335f1819fa77582be6a4795a1bb9350dd1a893f20e63f398a5ba095b6156fe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.9
|