blob: f82eb3a61b2234b54ca166e10c71df769c962f99 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/env python
depth = 0
dist = 0
with open("day2.txt") as data:
for line in data:
match line.split():
case ["forward", x]:
dist += int(x)
case ["up", x]:
depth -= int(x)
case ["down", x]:
depth += int(x)
print(depth * dist)
depth = 0
dist = 0
aim = 0
with open("day2.txt") as data:
for line in data:
match line.split():
case ["forward", x]:
dist += int(x)
depth += aim * int(x)
case ["up", x]:
aim -= int(x)
case ["down", x]:
aim += int(x)
print(depth * dist)
|