Skip to content

Instantly share code, notes, and snippets.

@rtt
Last active December 3, 2020 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtt/bc7b69ed5ad9e95316085f924410ecbd to your computer and use it in GitHub Desktop.
Save rtt/bc7b69ed5ad9e95316085f924410ecbd to your computer and use it in GitHub Desktop.
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