Completed first day successful
This commit is contained in:
18
Day0/doorOne.py
Normal file
18
Day0/doorOne.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
file = open('/Users/mastermito/Dev/AdventOfCode/Day0/input.txt', 'r')
|
||||||
|
|
||||||
|
#start of dial
|
||||||
|
number = 50
|
||||||
|
#counter for zeros
|
||||||
|
counter = 0
|
||||||
|
|
||||||
|
lines = file.readlines()
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
step = int(line[1:])
|
||||||
|
direction = 1 if line.startswith('R') else -1;
|
||||||
|
|
||||||
|
number = (number + (direction * step)) % 100
|
||||||
|
|
||||||
|
print('counter:', counter)
|
||||||
|
|
||||||
|
file.close()
|
||||||
21
Day0/doorTwo.py
Normal file
21
Day0/doorTwo.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
file = open('/Users/mastermito/Dev/AdventOfCode/Day0/input.txt', 'r')
|
||||||
|
|
||||||
|
#start of dial
|
||||||
|
number = 50
|
||||||
|
#counter for zeros
|
||||||
|
counter = 0
|
||||||
|
|
||||||
|
lines = file.readlines()
|
||||||
|
for line in lines:
|
||||||
|
step = int(line[1:])
|
||||||
|
direction = 1 if line.startswith('R') else -1;
|
||||||
|
|
||||||
|
for singleStep in range(step):
|
||||||
|
number = number + direction
|
||||||
|
number = number % 100
|
||||||
|
if number == 0:
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
print('counter:', counter)
|
||||||
|
|
||||||
|
file.close()
|
||||||
4168
Day0/input.txt
Normal file
4168
Day0/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user