Android Question Help needed for special sort/filter algorithym

tsteward

Well-Known Member
Licensed User
Longtime User
I need help to write a routine:

A little background first.
My app is for locksmiths who make keys to vehicles.
As the door lock is easiest to remove and make a key to, the manufacturers often leave some components out se we cant get a full picture of the key. After searching a key code database I can return all the possibilities by searching for the known key cuts/bitting learnt from the door lock.

Now I need to sort the result into such an order that I can re-cut a keyblank as many times as possible thus not wasting too many keyblanks and time.
Keep in mind a #1 cut removes little material from a key, to a #4 cut that removes most material meaning that part of the key cannot be cut any further.

Here are some images from a desktop app that does what I am trying to acheive.
The trick is determing which code gives the best bitting to perform the highest amount of recutting, then determining the order of the rest.

From this example you can see it only takes 9 keyblanks if your really unlucky, to cut the entire 27 different key possibilities.
Hope this makes sense to someone!

Search database
ScreenClip1.png

Result returned
ScreenClip2.png

Desired result
ScreenClip3.png
 
Top