Adventure Time

a guest Jan 2nd, 2013 1,110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from __future__ import print_function
  3. """
  4. Adventure Time Comic #11 Secret Messages
  5. ========================================
  6. I had a hunch that the messages were letter values encoded in
  7. trinary but substituting BMO for 012 didn't work so I tried
  8. some more methods. Turns out it's OMB (BMO backwards) and
  9. the number -> letter substitution is backwards from Z too.
  11. I won't ruin the surprise here but you can see the properly
  12. decoded messages (among the other wrong attempts) by running
  13. this Python script.
  15. -blayde
  16. """
  18. MESSAGES = [
  19.     'obo boo mbb obm bom bbm mmm bmo mbb obm bob omb mmo',
  20.     'omo bbm mbb obo omo boo bbm obo bbm obb bmo obo boo bmo obm bmo omo bmo mbb obb bmm mbb mmo obm obo obb omb bmb obo mbb mob mmo obm',
  21.     'mmb bmo omm bmo mmb mmo mbb mmo bmo mom obb mob obo mob bmb mob mmb mob omm bmo obb omo obb mbb obo bmo obm omb bmb bmb bmo obm obm',
  22.     'mmo bmo omo obm omb bbo obb mob omb obo mbb mmo bmo mbb mmo obm obo bbm mmb mmb bbm obo mbb mob mmo bmb mob mmm mom mmb bmo obo bmo',
  23. ]
  25. # all permutations of 'bmo'
  26. REPLACEMENTS = ['bmo', 'bom', 'mob', 'mbo', 'omb', 'obm']
  28. CONVERTERS = [
  29.     lambda x: chr(ord('a') + int(x, 3)),  # forwards from a
  30.     lambda x: chr(ord('z') - int(x, 3)),  # backwards from z
  31. ]
  33. for message in MESSAGES:
  34.     attempts = [''] * (len(REPLACEMENTS) * len(CONVERTERS))
  35.     for letter in message.split(' '):
  36.         for i, r in enumerate(REPLACEMENTS):
  37.             replaced = letter.replace(r[0], '0').replace(r[1], '1').replace(r[2], '2')
  38.             for j, c in enumerate(CONVERTERS):
  39.                 attempts[i * len(CONVERTERS) + j] += c(replaced)
  40.     for attempt in attempts:
  41.         print(attempt)
  42.     print()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand