Files
AdventOfCode2025/Problem1_1.py
2025-12-03 20:50:55 -05:00

47 lines
709 B
Python

def readFile():
ary = []
with open("files/Problem1.txt") as file:
for line in file:
ary.append(line)
return ary
def moveLocation(location: int, movement: str) -> int:
clockwise = movement[0] == 'R'
number = int(movement[1:])
if clockwise :
location += number
location %= 100
else :
location -= number
while location < 0 :
location += 100
return location
testArray = [
"L68",
"L30",
"R48",
"L5",
"R60",
"L55",
"L1",
"L99",
"R14",
"L82"
]
location = 50
result = 0
#movementArray = testArray
movementArray = readFile()
for movement in movementArray :
location = moveLocation(location, movement)
if location == 0 :
result += 1
print(f"Result: {result}")
#Result: 1195