Skip to content

Instantly share code, notes, and snippets.

@ewjoachim
Last active November 25, 2021 22:35
Show Gist options
  • Save ewjoachim/07851085ee78ebb0d5efb6702166df4e to your computer and use it in GitHub Desktop.
Save ewjoachim/07851085ee78ebb0d5efb6702166df4e to your computer and use it in GitHub Desktop.
CLMystery as a python "one-liner" (well, one expression)
"Yay" if __import__("hashlib").md5((next((n & g).pop() for g, n in
(
(g, set(dr["Owner"] for dr in v if all(el in t.lower().split() for el in
[
dr["Color"].lower(), dr["Make"].lower(),
dr["Height"].split("'")[0] + "'",
]) and
dr["License Plate"].startswith(__import__("re")
.search(r'starts with "([A-Z0-9]+)"', t).group(1)) and
dr["License Plate"].endswith(__import__("re")
.search(r'ends with "([A-Z0-9]+)"', t).group(1))
) & set(s))
for t, s, v, p, g in (
(
__import__("re").sub(
r"[^\w '\"]", " ",
next(
itw for itw in (p(pw) for pw in pws)
if itw.startswith("Interviewed")
) + " " + t1
),
s, v, p,
{
k for k, v in (pe.split("\t", 1) for pe in open("people").readlines()[8:])
if v[0] == next(
g for g in ("male", "female")
if g in t1.replace(",", "").split()
)[0].upper()
},
)
for (t1, s, pws), v, p in [[
(f(l2) for f, l2 in zip(
(
lambda x: x,
lambda x: list(
n[:-1]
for n in set.intersection(*(
set(
open("memberships/" + f).readlines()
)
for f in
set(map(
{w: m
for m in __import__("os").listdir("memberships")
for w in m.lower().split("_")
}.__getitem__,
set(x.lower().replace(",", "").split()) &
set(
w2
for e in __import__("os").listdir("memberships")
for w2 in e.lower().split("_")
)
))
))
),
lambda x: list(i for i, p in enumerate(open("people").readlines()[8:])
if (p.split()[0] in x.replace(",", "").split()) and
({"M": "man", "F": "woman"}[p.split("\t")[1]] in x.split())),
),
(l for l in open("crimescene") if l.startswith("CLUE:"))
)),
[
dict(l.split(": ") for l in e.split("\n"))
for e in open("vehicles").read()[115:]
.replace("Plate", "Plate:").strip().split("\n\n")
],
lambda n: open("interviews/interview-" + next((
open("streets/" + st.replace(" ", "_")).readlines()[int(li) - 1]
for st, li in
[open("people").readlines()[8:][n]
.strip().split("\t")[-1].split(", line")
]
)).strip().split("#")[1]).read()
]]
)
)
) + "\n").encode()).hexdigest() == open("../encoded").read()[:32] else "Nay :("
"Yay" if __import__("hashlib").md5((next((n & g).pop() for g, n in ((g, set(dr["Owner"] for dr in v if all(el in t.lower().split() for el in [ dr["Color"].lower(), dr["Make"].lower(), dr["Height"].split("'")[0] + "'",]) and dr["License Plate"].startswith(__import__("re") .search(r'starts with "([A-Z0-9]+)"', t).group(1)) and dr["License Plate"].endswith(__import__("re") .search(r'ends with "([A-Z0-9]+)"', t).group(1))) & set(s)) for t, s, v, p, g in ((__import__("re").sub(r"[^\w '\"]", " ", next(itw for itw in (p(pw) for pw in pws) if itw.startswith("Interviewed")) + " " + t1), s, v, p, { k for k, v in (pe.split("\t", 1) for pe in open("people").readlines()[8:]) if v[0] == next(g for g in ("male", "female") if g in t1.replace(",", "").split())[0].upper()},) for (t1, s, pws), v, p in [[ (f(l2) for f, l2 in zip((lambda x: x, lambda x: list(n[:-1] for n in set.intersection(*(set(open("memberships/" + f).readlines()) for f in set(map({w: m for m in __import__("os").listdir("memberships") for w in m.lower().split("_")}.__getitem__, set(x.lower().replace(",", "").split()) & set(w2 for e in __import__("os").listdir("memberships") for w2 in e.lower().split("_"))))))), lambda x: list(i for i, p in enumerate(open("people").readlines()[8:]) if (p.split()[0] in x.replace(",", "").split()) and ({"M": "man", "F": "woman"}[p.split("\t")[1]] in x.split())),), (l for l in open("crimescene") if l.startswith("CLUE:")))), [ dict(l.split(": ") for l in e.split("\n")) for e in open("vehicles").read()[115:] .replace("Plate", "Plate:").strip().split("\n\n")], lambda n: open("interviews/interview-" + next((open("streets/" + st.replace(" ", "_")).readlines()[int(li) - 1] for st, li in [open("people").readlines()[8:][n] .strip().split("\t")[-1].split(", line")])).strip().split("#")[1]).read()]]))) + "\n").encode()).hexdigest() == open("../encoded").read()[:32] else "Nay :("
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment