Created
December 21, 2019 05:37
-
-
Save bluepichu/147cf3d5dd338a304f23ed227de2ca5d to your computer and use it in GitHub Desktop.
Advent of Code 2019 day 21 solution
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
# intcode interpreter omitted | |
def go(): | |
p = make_process(inp) | |
p = start(p) | |
while p[0] != DONE: | |
if p[0] == INPUT: | |
i = input() | |
for c in i: | |
p = inpt(p, ord(c)) | |
assert p[0] == INPUT | |
p = inpt(p, 10) | |
elif p[0] == OUTPUT: | |
out = get_output(p) | |
if out >= 256: | |
print(out) | |
return | |
print(chr(out), end="") | |
p = cont(p) | |
go() |
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
NOT A J | |
NOT B T | |
OR T J | |
NOT C T | |
OR T J | |
AND D J | |
WALK |
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
NOT A J | |
NOT B T | |
OR T J | |
NOT C T | |
OR T J | |
AND D J | |
NOT H T | |
NOT T T | |
OR E T | |
AND T J | |
RUN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment