+/AoC
advent of code
git clone https://git.julia.blue/+/AoC
38c0746
master
1with open ("input.txt" )as f : 2raw = f .read ().strip ().split (',' ) 3 4directions = {'n' : (1 ,- 1 ,0 ), 5'nw' : (1 ,0 ,- 1 ), 6'sw' : (0 ,1 ,- 1 ), 7's' : (- 1 ,1 ,0 ), 8'se' : (- 1 ,0 ,1 ), 9'ne' : (0 ,- 1 ,1 )} 10 11total = [0 ,0 ,0 ] 12distances = [] 13 14for i in raw : 15total = map (sum ,zip (total ,directions [i ])) 16distances .append (abs (max (total ))) 17 18"Part 1:" ,distances [- 1 ] 19"Part 2:" ,max (distances )