Skip to content

Instantly share code, notes, and snippets.

@grabovszky
Created December 2, 2022 17:03
Show Gist options
  • Save grabovszky/2b7a7d33aa44c9063093017a98b87557 to your computer and use it in GitHub Desktop.
Save grabovszky/2b7a7d33aa44c9063093017a98b87557 to your computer and use it in GitHub Desktop.
Advent of Code 2022 Day 2
data = open("input.txt").read()
score = 0
for line in data.split("\n"):
player1, player2 = line.split()
if player2 == "X":
if player1 == "C":
score += 6
if player1 == "A":
score += 3
score += 1
if player2 == "Y":
if player1 == "A":
score += 6
if player1 == "B":
score += 3
score += 2
if player2 == "Z":
if player1 == "B":
score += 6
if player1 == "C":
score += 3
score += 3
print(score)
data = open("input.txt").read()
score = 0
for line in data.split("\n"):
player1, player2 = line.split()
if player2 == "X":
if player1 == "A":
score += 3
if player1 == "B":
score += 1
if player1 == "C":
score += 2
score += 0
if player2 == "Y":
if player1 == "A":
score += 1
if player1 == "B":
score += 2
if player1 == "C":
score += 3
score += 3
if player2 == "Z":
if player1 == "A":
score += 2
if player1 == "B":
score += 3
if player1 == "C":
score += 1
score += 6
print(score)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment