Legend:
- Unmodified
- Added
- Removed
-
hand.py
r5 r6 1 1 import deck 2 2 3 hand_orders = ["straight_flush", 3 hand_orders = [ "high_card", 4 "pair", 5 "two_pair", 6 "three_of_a_kind", 7 "straight", 8 "flush", 9 "full_house", 4 10 "four_of_a_kind", 5 "full_house", 6 "flush", 7 "straight", 8 "three_of_a_kind", 9 "two_pair", 10 "pair", 11 "high_card"] 11 "straight_flush" ] 12 12 13 13 #returns the best combination for the 5 cards 14 14 def judge_hand(cards): 15 15 ret = is_straight_flush(cards) 16 if ret: return ret 17 else: return is_n_kinds([a for (a,b) in cards]) 16 if not ret: ret = is_n_kinds([a for (a,b) in cards]) 17 #replace the text with a value 18 return (hand_orders.index(ret[0]), ret[1]) 19 18 20 19 21 #for all these functions, make sure cards are sorted DESCENDING!!!! … … 69 71 #now check if it's two pair 70 72 if len(whats_left) >= 2: 71 print highest_card72 73 ret = is_n_kinds(whats_left) 73 74 #if the subset is a pair then this is a two pair
