Last active
December 3, 2020 14:05
-
-
Save rtt/bc7b69ed5ad9e95316085f924410ecbd 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 get_input(): | |
with open('input3full.txt') as f: | |
passwords = f.readlines() | |
return map(str.strip, passwords) | |
def get_next(right, down, x, y, land_map): | |
x += right | |
y += down | |
line = land_map[y] | |
return land_map[y][x % len(land_map[y])], x, y | |
def run(): | |
land_map = list(get_input()) | |
count, right, down, x, y = 0, 3, 1, 0, 0 | |
while y < len(land_map)-1: | |
char, x, y = get_next(right, down, x, y, land_map) | |
if char == '#': | |
count += 1 | |
print(count) | |
if __name__ == '__main__': | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment