feat: day1.2
This commit is contained in:
parent
96b7dcec41
commit
833478451a
1 changed files with 8 additions and 6 deletions
|
|
@ -9,13 +9,15 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
for rotation in rotations:
|
for rotation in rotations:
|
||||||
print(rotation)
|
print(rotation)
|
||||||
# Convert left to right to avoid negatives
|
if rotation['direction'] == 'L':
|
||||||
if rotation["direction"] == 'L':
|
direction = -1
|
||||||
rotation["count"] = TOTAL_CLICKS - rotation["count"]
|
else:
|
||||||
|
direction = 1
|
||||||
|
|
||||||
current = (current + rotation["count"]) % TOTAL_CLICKS
|
for _ in range(rotation['count']):
|
||||||
|
current = (current + direction) % TOTAL_CLICKS
|
||||||
|
|
||||||
if current == 0:
|
if current == 0:
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
print(count)
|
print(count)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue