Day 12 (removed comments)
This commit is contained in:
@@ -24,13 +24,11 @@ def rotate(current, amount):
|
||||
|
||||
|
||||
for line in lines:
|
||||
print(line)
|
||||
if line[0] in target_str:
|
||||
pos += direction(line[0]) * line[1]
|
||||
elif line[0] in "LR":
|
||||
drctn = rotate(drctn, -line[1] if line[0] == "R" else line[1])
|
||||
else:
|
||||
pos += drctn * line[1]
|
||||
print(pos, drctn)
|
||||
|
||||
print(sum(np.abs(pos)))
|
||||
|
||||
@@ -24,13 +24,11 @@ def rotate(current, amount):
|
||||
|
||||
|
||||
for line in lines:
|
||||
print(line)
|
||||
if line[0] in target_str:
|
||||
drctn += direction(line[0]) * line[1]
|
||||
elif line[0] in "LR":
|
||||
drctn = rotate(drctn, -line[1] if line[0] == "R" else line[1])
|
||||
else:
|
||||
pos += drctn * line[1]
|
||||
print(pos, drctn)
|
||||
|
||||
print(sum(np.abs(pos)))
|
||||
|
||||
Reference in New Issue
Block a user