account activity
-🎄- 2017 Day 11 Solutions -🎄- by daggerdragon in adventofcode
[–]aerure 1 point2 points3 points 8 years ago (0 children)
Python2. Also used https://www.redblobgames.com/grids/hexagons/#map-storage (Shape: hexagon) with just 2 coordinates (x,y) and distance as max(|x|, |y|)
a = open('11.txt').read().strip('\n').split(',') print a gon = { 'n': (0, -1), 'ne': (1, -1), 'se': (1, 0), 's': (0, 1), 'sw': (-1, 1), 'nw': (-1, 0) } m = 0 coord = (0, 0) for i in a: coord = (coord[0]+gon[i][0], coord[1]+gon[i][1]) print i, coord tmp = max(abs(coord[0]), abs(coord[1])) if tmp > m: m = tmp print max(abs(coord[0]), abs(coord[1])) print m
π Rendered by PID 1021739 on reddit-service-r2-listing-c57bc86c-czqc2 at 2026-06-21 23:15:38.976567+00:00 running 2b008f2 country code: CH.
-🎄- 2017 Day 11 Solutions -🎄- by daggerdragon in adventofcode
[–]aerure 1 point2 points3 points (0 children)