This commit is contained in:
starnakin 2023-12-07 12:12:57 +01:00
parent 5ad716e9a0
commit c9a3d978d8

View File

@ -19,6 +19,7 @@ sames = []
for line in lines: for line in lines:
bozo: [str] = line.split() bozo: [str] = line.split()
same = get_same(bozo[0]) same = get_same(bozo[0])
same.update({"value": int(bozo[1])})
sames.append(same) sames.append(same)
@ -29,10 +30,10 @@ def get_highest(cards1, cards2, i):
return 2 return 2
if (i != 1 and len(cards1) > len(cards2)): if (i != 1 and len(cards1) > len(cards2)):
return 1 return 1
for k in range(min(len(cards2), len(cards1))): for char1, char2 in zip(cards1, cards2):
if (cards2[k] == cards1[k]): if (char2 == char1):
continue continue
if (CARDS.index(cards1[k]) > CARDS.index(cards2[k])): if (CARDS.index(char1) > CARDS.index(char2)):
return 2 return 2
else: else:
return 1 return 1
@ -69,7 +70,8 @@ for i, line in enumerate(lines):
key, value = line.split() key, value = line.split()
for j, bozo in enumerate(sort): for j, bozo in enumerate(sort):
if (bozo.get("original", "") == key): if (bozo.get("original", "") == key):
_value += (len(lines) - j) * int(value) _value += (len(lines) - j) * bozo.get("value")
print(f'{(len(lines) - j)}, {bozo.get("value")}')
break break
print(_value) print(_value)