-
-
Save pawlos/931710a8cb12a6a0e7a1196e7f74a241 to your computer and use it in GitHub Desktop.
Solution to Day 5: A Maze of Twisty Trampolines, All Alike - Part 2
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
lines = open('input_d5.txt','r').readlines() | |
#lines = ["0","3","0","1","-3"] | |
inputs = [int(l) for l in lines] | |
i = 0 | |
cnt = 0 | |
while True: | |
s = inputs[i] | |
if inputs[i] >= 3: | |
inputs[i] -= 1 | |
else: | |
inputs[i] += 1 | |
cnt += 1 | |
if i + s >= len(inputs) or i+s<0: | |
break | |
if len(inputs) < 10: | |
print s, i, inputs | |
i += s | |
print cnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment