This commit is contained in:
basicbonobo 2023-12-23 21:05:40 +01:00
parent 74e98ac3a6
commit d96f4b19d9
2 changed files with 35 additions and 0 deletions

21
achtzehn.py Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
from useful import *
dirind = {'U': (-1, 0),
'D': (1, 0),
'L': (0, -1),
'R': (0, 1)}
def parse(l):
rection, distance, pcolor = l.strip().split()
return np.asarray(dirind[rection]), int(distance), pcolor
guide = [parse(l) for l in lines(open(0))]
edges = []
head = np.asarray((0, 0))
for rection, distance, _ in guide:
tail = head
head = head + rection * distance
edges += [(tail, head)]
ic(edges)

14
test18 Normal file
View File

@ -0,0 +1,14 @@
R 6 (#70c710)
D 5 (#0dc571)
L 2 (#5713f0)
D 2 (#d2c081)
R 2 (#59c680)
D 2 (#411b91)
L 5 (#8ceee2)
U 2 (#caa173)
L 1 (#1b58a2)
U 2 (#caa171)
R 2 (#7807d2)
U 3 (#a77fa3)
L 2 (#015232)
U 2 (#7a21e3)