Skip to content

Instantly share code, notes, and snippets.

@proelbtn
Last active January 29, 2019 03:02
Show Gist options
  • Save proelbtn/9aa46c7e594448a4c7990d351a36555c to your computer and use it in GitHub Desktop.
Save proelbtn/9aa46c7e594448a4c7990d351a36555c to your computer and use it in GitHub Desktop.
import random; (lambda ws: (print("Hello! Let's play hangman!"), random.shuffle(ws), all(((lambda f: (print("Congratulation!" if f() else "Gameover... Answer is %s" % w), input("continue? (y/n): ") in ["y", "Y", "yes", "Yes", "YES"])[1])((lambda: (lambda cs, ins:(lambda f: f(f, 5))((lambda f, l: (print("life: %d, inputs: %s" % (l, ",".join(sorted(ins)))), print("".join([c if c in ins else '_' for c in w])), (lambda c: ((ins.add(c), f(f, l if c in cs else l - 1) if not cs.issubset(ins) else True)[1] if not c in ins else f(f, l)) if len(c) == 1 else f(f, l))(input("> ")) if l != 0 else False)[2])))({c for c in w}, set()))) for w in ws)), print("Goodbay!")))(open("words").read().splitlines())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment