Solve open the lock puzzle.
Project description
Opener
Opener is a puzzle solver Python package. Currently it solves the Open the lock puzzle.
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
The above figure outlines an Open the Lock puzzle. A valid unlock key of the above puzzle is: 679
example.py shows how to use opener package to solve the above puzzle.
To solve an 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
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.
The following steps can be used to create release package for PyPi.
- Create a virtual environment:
python3 -m venv venv
- Activate virtual environment:
source venv/bin/activate
- Install necessary packages:
pip install -r development.txt
- Generate dist files:
python setup.py sdist bdist_wheel
- Upload to TestPyPI which is a separate instance of the Python Package Index. A TestPyPI account is needed for this which can be registered from https://test.pypi.org/:
twine upload --repository testpypi dist/*
- If there is no error, then the package will be uploaded to TestPyPI.
- To test the TestPyPI package, create a virtual environment, activate it and finally install the package:
pip install -i https://test.pypi.org/simple/ PACKAGE_NAME==PACKAGE_VERSION
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.