Skip to content

Instantly share code, notes, and snippets.

@icemnki
Last active June 25, 2020 18:07
Show Gist options
  • Save icemnki/8b1698528ff2f38d08b662d5b2dfb75e to your computer and use it in GitHub Desktop.
Save icemnki/8b1698528ff2f38d08b662d5b2dfb75e to your computer and use it in GitHub Desktop.
function ( a , { t } )
{// t:#s.name.loc
var c = { } , p , v , r , x , s , i = 0 ,
P = "red0purple0blue0cyan0green0lime0yellow0orange020305070110130170190230290310370410430470530590610670710730790830890970unlock0open0release" . split ( 0 ) ,
z = "_..!|1!|2!|3!|or n|d c| com|k c|color_digit|c002_complement|c003_triad_1|c003_triad_2|!d|t d|pr",
Z = z . split ( '|' )
for ( ; v = ( r = t . call ( c ) ) . match ( z ) ; c [ p ] = x , i ++ )
s = Z . indexOf ( v = v [ 0 ] ) ,
s > 13 ? c . ez_prime = + P [ i % 25 + 8 ] :
s > 11 ? c . digit = i%10:
s > 8 ? p = v :
s > 7 ? c [ v ] = x.length :
x = s > 6 ? P [ i % 3 + 33 ] :
s > 3 ? P [ i % 8 ] :
p = s > 0 ? "c00" + v [ 0 ] :
"EZ_" + v [ 1 ] + v [ 2 ]
return r
}
@smrq
Copy link

smrq commented Oct 3, 2016

This is a thing of beauty.

@smrq
Copy link

smrq commented Oct 3, 2016

Btw, you can drop 4 characters by using ES6 destructuring in the header:

function ( a , { t } )
{// t:#s.name.loc
  var c = { } , p , v , r , x , s , i = 0 ,

@icemnki
Copy link
Author

icemnki commented Oct 3, 2016

Good tip, smrq! I'll add that.

@Powerhobo
Copy link

This thing is amazing in how it is written but I noticed it appears to fail on all c00x locks. Oddly enough, it works on dtr's t1 lock sim and I suspect I know what is bugging it out:
The fail message for presenting the wrong digit in dtr's sim differs from the one on the actual locks. Could it be that your lock has mostly been tested against dtr's simulation?

@icemnki
Copy link
Author

icemnki commented Oct 5, 2016

Was having issues involving the color_digit, but should be working as of the current version.

@smrq
Copy link

smrq commented Oct 5, 2016

@icemnki Nice 👍 I rewrote this myself last night using your technique in order to fix c001s, got it down to 494 💪

@shoe7ess
Copy link

shoe7ess commented Oct 10, 2016

this mixed with a hashing script is golden 5 mil every few minutes at least.

@G1itcher
Copy link

This doesn't seem to work anymore. It's a bitch to debug!

Copy link

ghost commented Feb 17, 2017

it's somethin', though

@TL044CN
Copy link

TL044CN commented Dec 8, 2019

you can shave off more bytes by using string templates and whitespaces (\n and space) because the game doesnt recognize them as a character.
Ive seen someone writing a script that encoded itself completely in whitespaces making it about 30 bytes to the game.
This is an example what you could do:

  P = "red purple blue cyan green lime yellow orange 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 unlock open release" . split` ` ,
  z = "_..!
1!
2!
3!
or n
d c
 com
k c
color_digit
c002_complement
c003_triad_1
c003_triad_2
!d
t d
pr",
  Z = z . split`
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment