8000 Add files via upload · jrmdev1/adventofcode2021@6711898 · GitHub
[go: up one dir, main page]

Skip to content < 8000 div data-target="react-partial.reactRoot">

Commit 6711898

Browse files
authored
Add files via upload
1 parent 88f50d0 commit 6711898

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

2b.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# import sys
55
# import re
66

7-
filename = "data2_short.txt"
7+
filename = "data2.txt"
88

99
file = open(filename)
1010
filestr = file.read()
@@ -14,16 +14,16 @@
1414

1515
depth = 0
1616
hpos = 0
17+
aim = 0
1718
for line in a_list:
1819
match line.split():
19-
#cmd_val = line.split(" ")
20-
#val = int(cmd_val[1])
2120
case "forward", val:
2221
hpos += int(val)
22+
depth += aim*(int(val))
2323
case "down", val:
24-
depth += int(val)
24+
aim += int(val)
2525
case "up", val:
26-
depth -= int(val)
26+
aim -= int(val)
2727
case _:
2828
print(f"error: {line}")
2929
exit()

0 commit comments

Comments
 (0)
0