ChastiKey Forums

General Category => ChastiKey Chat => Topic started by: KevinCross on August 12, 2019, 11:13:53 AM

Title: Python ChastiKey lock generator
Post by: KevinCross on August 12, 2019, 11:13:53 AM
I've created a simple python script which generates random variable lock card set ups, saves them to a datafile and gives you the option to search that data for locks that meet the desired duration you're after. To get the best results it's good to generate a good number of locks, but they don't need to be generated all in one go (regularly with small numbers is best). Generating a 1,000 locks in one go can take a little while.

The examples.py file that comes with the script shows how to call the different function/commands that are available. And here's a simple example without all of the comments that will generate 10 locks, and then search those 10 locks for one that lasts between 4 and 10 hours. That's a duration of 7 hours but with a variation of 3 hours either side. You may not get any matches the first time you run it, but each time you generate new locks you're adding to the existing locks that you created previously which is improving the chance of finding that perfect lock.

Code: [Select]
import ChastiKey as ck

chastikey = ck.ChastiKey()
chastikey.GenerateLocks(number_of_locks=10)
chastikey.SearchLocks(regularity=1, duration=7, variation=3, number_of_locks=1)

This was something I created while travelling when I couldn't really work on the main ChastiKey app.

https://github.com/KevinCrossDCL/ChastiKey/tree/master/python/ChastiKey


Title: Re: Python ChastiKey lock generator
Post by: DogMike on August 14, 2019, 02:52:05 AM
How to we use this? Do we have to manually copy a file to our device or is this something we run on a computer?
Title: Re: Python ChastiKey lock generator
Post by: KevinCross on August 14, 2019, 06:55:25 AM
You can run pyhon on your mobile device with the right app but that wasn't the intention. It was intended for users that have python installed on their desktop or laptops and that know how to run/code python scripts.

The output is displayed in a terminal/cmd type window so not pretty.

I've been playing about with PySimpleGUI at work recently so may look at creating a basic UI in the future when I have some free time.