Created
January 26, 2016 06:07
-
-
Save ChrisBeaumont/f1e52b253b24f9b38645 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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