Day 02
This commit is contained in:
2500
day02/input.txt
Normal file
2500
day02/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
2
day02/part1.min.py
Normal file
2
day02/part1.min.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
print(sum(ord(x)-87+(ord(x)-ord(a)-1)%3*3 for a,_,x,_ in open("input.txt")))
|
||||||
16
day02/part1.py
Normal file
16
day02/part1.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
lines = (x.strip() for x in open("input.txt"))
|
||||||
|
results = {
|
||||||
|
'A X': 1 + 3,
|
||||||
|
'A Y': 2 + 6,
|
||||||
|
'A Z': 3,
|
||||||
|
'B X': 1,
|
||||||
|
'B Y': 2 + 3,
|
||||||
|
'B Z': 3 + 6,
|
||||||
|
'C X': 1 + 6,
|
||||||
|
'C Y': 2,
|
||||||
|
'C Z': 3 + 3
|
||||||
|
}
|
||||||
|
|
||||||
|
print(sum(results[line] for line in lines))
|
||||||
2
day02/part2.min.py
Normal file
2
day02/part2.min.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
print(sum(ord(x)*3-263+(ord(x)+ord(a)-1)%3 for a,_,x,_ in open("input.txt")))
|
||||||
17
day02/part2.py
Normal file
17
day02/part2.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
lines = (x.strip() for x in open("input.txt"))
|
||||||
|
results = {
|
||||||
|
'A X': 3,
|
||||||
|
'A Y': 1 + 3,
|
||||||
|
'A Z': 2 + 6,
|
||||||
|
'B X': 1,
|
||||||
|
'B Y': 2 + 3,
|
||||||
|
'B Z': 3 + 6,
|
||||||
|
'C X': 2,
|
||||||
|
'C Y': 3 + 3,
|
||||||
|
'C Z': 1 + 6,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print(sum(results[line] for line in lines))
|
||||||
Reference in New Issue
Block a user