Advent of Code Solutions Thread: Day Two

Only shitty solutions allowed

38
Jump in the discussion.

No email address required.

file = open("input.txt")

outcomes = [[4, 8, 3], [1, 5, 9], [7, 2, 6]]
outcomes2= [[3,4,8], [1,5,9], [2,6,7]]
score = 0
score2= 0
for line in file:
    x_index = int(ord(line[0]))-65
    y_index = int(ord(line[2]))-88
    score += outcomes[x_index][y_index]
    score2 += outcomes2[x_index][y_index]
print(score)
print(score2)

Spent more time making the matrices than i did writing the code lol

Jump in the discussion.

No email address required.

Realizing now i could have cut out two lines by making r-slurred array indeces instead of assigning them to variables on separate lines. I strive for compact illegibility

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.