aoc
/
2022
1
0
Fork 0
2022/day02.py

19 lines
348 B
Python
Raw Permalink Normal View History

2022-12-04 10:12:00 +00:00
import fileinput
2022-12-24 14:59:27 +00:00
def main():
part1, part2 = 0, 0
2022-12-04 10:12:00 +00:00
2022-12-24 14:59:27 +00:00
for line in fileinput.input(mode="rb"):
theirs = line[0] - ord("A")
ours = line[2] - ord("X")
2022-12-04 10:12:00 +00:00
2022-12-24 14:59:27 +00:00
part1 += ours + (ours - theirs + 1) % 3 * 3 + 1
part2 += ours * 3 + (theirs + ours - 1) % 3 + 1
print(part1, part2)
if __name__ == "__main__":
main()