Solve open the lock puzzle.

# 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


## 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.

## Changelog

### 0.0.3 (2020-10-03)

• Added four digits open the lock example
• Updated tests
• Separated development guideline

### 0.0.2 (2020-10-02)

• Release to PyPI

### 0.0.1 (2020-10-01)

• Initial release

## Project details

Uploaded Source
Uploaded Python 3