38 lines
726 B
Python
38 lines
726 B
Python
from common import parse
|
|
|
|
|
|
def round(game: tuple[str, str]) -> int:
|
|
if game[0] == "A":
|
|
if game[1] == "X":
|
|
return 3
|
|
elif game[1] == "Y":
|
|
return 3 + 1
|
|
else:
|
|
return 6 + 2
|
|
elif game[0] == "B":
|
|
if game[1] == "X":
|
|
return 1
|
|
elif game[1] == "Y":
|
|
return 3 + 2
|
|
else:
|
|
return 6 + 3
|
|
else:
|
|
if game[1] == "X":
|
|
return 2
|
|
elif game[1] == "Y":
|
|
return 3 + 3
|
|
else:
|
|
return 6 + 1
|
|
|
|
|
|
def solve(strategy: list[tuple[str, str]]) -> int:
|
|
return sum(map(round, strategy))
|
|
|
|
|
|
def main():
|
|
print(solve(parse("input")))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|