fix: la gadji c'est un paqueta
This commit is contained in:
parent
b6f3782b51
commit
5ad716e9a0
@ -1,4 +1,4 @@
|
|||||||
text: str = open("example.txt", "r").read()
|
text: str = open("input.txt", "r").read()
|
||||||
|
|
||||||
_value: int = 0
|
_value: int = 0
|
||||||
|
|
||||||
@ -10,8 +10,8 @@ def get_same(string: str):
|
|||||||
sames = {"original": string}
|
sames = {"original": string}
|
||||||
for card in CARDS:
|
for card in CARDS:
|
||||||
if string.count(card) != 0:
|
if string.count(card) != 0:
|
||||||
bozo: list = sames.get(string.count(card), [])
|
bozo: list = sames.get(string.count(card), "")
|
||||||
bozo.append(card)
|
bozo += (card)
|
||||||
sames.update({string.count(card): bozo})
|
sames.update({string.count(card): bozo})
|
||||||
return sames
|
return sames
|
||||||
|
|
||||||
@ -38,31 +38,31 @@ def get_highest(cards1, cards2, i):
|
|||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def get_index(lst: [dict], original: str):
|
||||||
|
for i, hand in enumerate(lst):
|
||||||
|
if (hand.get("original") == original):
|
||||||
|
return i
|
||||||
|
|
||||||
sort = [sames[0]]
|
sort = [sames[0]]
|
||||||
for same in sames[1:]:
|
for same in sames[1:]:
|
||||||
place = None
|
places = []
|
||||||
for i in range(5, 0, -1):
|
opponents: [dict] = sort.copy()
|
||||||
cards = same.get(i)
|
for card_index in range(5, 0, -1):
|
||||||
if (cards == None):
|
new = []
|
||||||
continue
|
for opponent in opponents:
|
||||||
for j, bozo in enumerate(sort):
|
my_cards = same.get(card_index, "")
|
||||||
_cards = bozo.get(i)
|
opponent_cards = opponent.get(card_index, "")
|
||||||
if _cards is None:
|
highest = get_highest(my_cards, opponent_cards, card_index)
|
||||||
continue
|
if (highest == 0):
|
||||||
highest = get_highest(_cards, cards, i)
|
new.append(opponent)
|
||||||
if (highest == 0 or highest == 1):
|
elif (highest == 1):
|
||||||
continue
|
places.append(get_index(sort, opponent.get("original")))
|
||||||
else:
|
opponents = new
|
||||||
place = j
|
if (places != []):
|
||||||
break
|
|
||||||
if (place is None):
|
|
||||||
place = 0
|
|
||||||
break
|
|
||||||
if (place is not None):
|
|
||||||
break
|
break
|
||||||
if (place is None):
|
if (places == []):
|
||||||
print(same, i)
|
places = [len(sort)]
|
||||||
place = 0
|
place = min(places)
|
||||||
sort.insert(place, same)
|
sort.insert(place, same)
|
||||||
|
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
@ -70,7 +70,6 @@ for i, line in enumerate(lines):
|
|||||||
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) * int(value)
|
||||||
print( (len(lines) - j), bozo.get("original"))
|
|
||||||
break
|
break
|
||||||
|
|
||||||
print(_value)
|
print(_value)
|
Loading…
Reference in New Issue
Block a user