Skip to content

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy