Skip to content

Instantly share code, notes, and snippets.

@rx13
Created November 16, 2016 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rx13/212c4f870d4d6d2bdfae194a0d0e3251 to your computer and use it in GitHub Desktop.
Save rx13/212c4f870d4d6d2bdfae194a0d0e3251 to your computer and use it in GitHub Desktop.
hackmud t1s
function(co, ar)
{
var r = /\!(\w+)\! lock\./,
lib = #s.scripts.lib(),
e = ["open", "unlock", "release"],
sl = ["EZ_21", "EZ_35", "EZ_40"],
l = ["c001", "c002", "c003"],
c = ["purple","blue","cyan","green","lime","yellow","orange","red"],
v = ["digit", "complement", "prime", "triad"],
z = [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],
g = function(a){return ar.t.call(a)},
n = function(a,b){return RegExp(b,'gi').test(a)},
p = {},
rs = g(p),
i = 0,
x = 0
while (true) {
try {
var s = r.exec(rs)[1],
ul = false
if (n(sl,s)){
e.forEach(function(k,ii){
if(! ul){
p[s]=k
rs = g(p)
if (n(rs,v[0])) {
ul = true
for (i = 0; i<10; i++){
if(n(rs,v[0])){
p[v[0]]=i
rs = g(p)
}
}
}
else if (n(rs,"ez_"+v[2])){
ul = true
z.forEach(function(k,ii){
if(n(rs,v[2])){
p["ez_"+v[2]]=k
rs = g(p)
}
})
}
else if ( n(rs, "CK_UN") && s == sl[0]) {ul = true}
}
})
}
else if (n(l,s)){
for (i = 0; i < 8; i++) {
if (! ul) {
p[s]=c[i]
rs = g(p)
if (n(rs,v[0])) {
ul = true
for (x = 0; x < 10; x++){
if (n(rs,v[0])) {
p["color_"+v[0]]=x
rs = g(p)
}
}
}
else if (n(rs,v[1])){
ul = true
p["c002_"+v[1]]=c[((i+4)%8)]
rs = g(p)
}
else if (n(rs,v[3])){
ul = true
p["c003_triad_1"]=c[((i+3)%8)]
p["c003_triad_2"]=c[((i+5)%8)]
rs = g(p)
}
}
}
}
else {
throw 1
}
} catch (e) {return `{ 0: ${rs}, 1: ${lib.json.ostringify(p)}, 2: ${e}}`}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment