| 13 | | #def format_hand(hand): |
| | 13 | def format_hand(hand): |
| | 14 | #TODO add Ace support |
| | 15 | kickers = [deck.CARDS[c] for c in hand[1] if c >= 0] |
| | 16 | name = HAND_ORDERS(hand[0]) |
| | 17 | if name == "high_card": |
| | 18 | return "high card (%s) with kickers (%s)" % (kickers.pop(0),kickers) |
| | 19 | elif name == "pair": |
| | 20 | return "pair of (%s)'s with kickers (%s)" % (kickers.pop(0),kickers) |
| | 21 | elif name == "two_pair": |
| | 22 | return "two pair of (%s)'s and (%s)'s with kickers (%s)" % (kickers.pop(0),kickers.pop(0),kickers) |
| | 23 | elif name == "four_of_a_kind": |
| | 24 | return "four of a kind (%s) with kickers (%s)" % (kickers.pop(0),kickers) |
| | 25 | elif name == "three_of_a_kind": |
| | 26 | return "three of a kind (%s) with kickers (%s)" % (kickers.pop(0),kickers) |
| | 27 | elif name == "flush": |
| | 28 | return "flush with high card (%s)" % (kickers.pop(0)) |
| | 29 | elif name == "straight_flush": |
| | 30 | return "straight flush with high card (%s)" % (kickers.pop(0)) |
| | 31 | elif name == "straight": |
| | 32 | return "straight with high card (%s)" % (kickers.pop(0)) |
| | 33 | elif name == "full_house": |
| | 34 | return "full house with (%s) over (%s)" % (kickers.pop(0),kickers.pop(0)) |
| | 35 | else: return "???" |
| | 36 | |
| | 37 | |