07-1 fertig
This commit is contained in:
33
07/07-1a.py
33
07/07-1a.py
@@ -33,17 +33,19 @@ def hand_type(s):
|
||||
for c in card_order:
|
||||
if s.count(c) == 4:
|
||||
return "Four", s
|
||||
elif ss.count(c) == 3 and (((ss[0] == ss[1] or ss[0] == ss[4]) and ss[0] != c) or (ss[3] == s[4] and ss[3] != c)):
|
||||
return "Full", s
|
||||
elif ss.count(c) == 3:
|
||||
for cc in card_order:
|
||||
if cc != c and ss.count(cc) == 2:
|
||||
return "Full", s
|
||||
return "Three", s
|
||||
elif ss.count(c) == 2:
|
||||
for cc in card_order:
|
||||
if cc != c and ss.count(cc) == 2:
|
||||
return "TwoPair", s
|
||||
elif cc != c and ss.count(cc) == 3:
|
||||
return "Full", s
|
||||
return "Pair", s
|
||||
else:
|
||||
return "High", s
|
||||
return "High", s
|
||||
|
||||
|
||||
typed_inp = []
|
||||
@@ -52,8 +54,8 @@ for i in inp:
|
||||
typed_inp.append([ty[0], ty[1], i[1]])
|
||||
|
||||
|
||||
for i in typed_inp:
|
||||
print(i)
|
||||
# for i in typed_inp:
|
||||
# print(i)
|
||||
|
||||
high_cards = []
|
||||
pair_cards = []
|
||||
@@ -92,31 +94,44 @@ three_cards.sort(key=card_sort, reverse=True)
|
||||
two_pair_cards.sort(key=card_sort, reverse=True)
|
||||
pair_cards.sort(key=card_sort, reverse=True)
|
||||
high_cards.sort(key=card_sort, reverse=True)
|
||||
#for c in high_cards:
|
||||
# print(c)
|
||||
|
||||
solution = 0
|
||||
i = 0
|
||||
print("High -----------------------------------------")
|
||||
for card in high_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
print("Pair -----------------------------------------")
|
||||
for card in pair_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
print("Two Pair -----------------------------------------")
|
||||
for card in two_pair_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
print("ThreeCards -----------------------------------------")
|
||||
for card in three_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
print("FullHouse -----------------------------------------")
|
||||
for card in full_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
print("FourCards -----------------------------------------")
|
||||
for card in four_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
print("FiveCards -----------------------------------------")
|
||||
for card in five_cards:
|
||||
i += 1
|
||||
solution += i*hand_dic[card]
|
||||
print(i, card, hand_dic[card])
|
||||
|
||||
print(solution, i)
|
||||
print()
|
||||
print(f"Lösung: {solution}")
|
||||
|
||||
Reference in New Issue
Block a user