Skip to content

Instantly share code, notes, and snippets.

@ChrisBeaumont
Created January 26, 2016 06:07
Show Gist options
  • Save ChrisBeaumont/f1e52b253b24f9b38645 to your computer and use it in GitHub Desktop.
Save ChrisBeaumont/f1e52b253b24f9b38645 to your computer and use it in GitHub Desktop.
def encode(clue):
"""Encode a plaintext clue into wheelscii."""
result = []
for c in clue:
if c == '\n':
result[-1] |= 0x80
else:
result.append(ord(c))
result[-1] |= 0x80
result[-2] |= 0x80
return bytes(result)
if __name__ == "__main__":
from parse_clues import parse_clues
rom = open('wheel.nes', 'rb').read()
start, stop = 0x109d0, 0x14618
data = rom[start:stop]
assert b''.join(map(encode, parse_clues(data))) == data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment