Advent of Code 2022 day 2

Only the part 2 code. I deleted part 1 while working out part 2. As can be seen from the print statements left in, this code is just left as is afterwards, warts and all.

with open("2.txt") as f:
    lines = f.read().splitlines()

for line in lines:
    print(line)

def three(x):
    if x == 0:
        return 3
    return x

def rps(x):
    if x == "A": #rock
        return 1
    elif x == "B": #paper
        return 2
    elif x == "C": #scissors
        return 3

def win_lose_draw(line):
    if line[-1] == "X":
        return 0
    elif line[-1] == "Y":
        return 3
    elif line[-1] == "Z":
        return 6

def rock_paper_scissor(line):
    if win_lose_draw(line) == 3:
        return rps(line[0])
    elif win_lose_draw(line) == 0:
        return three(rps(line[0])-1)
    else:
        return rps(line[0])%3+1

def game(line):
    return win_lose_draw(line) + rock_paper_scissor(line)

for line in lines:
    print(line, game(line), win_lose_draw(line), rock_paper_scissor(line))

print(sum([game(line) for line in lines]))