mirror of
https://github.com/correl/euler.git
synced 2024-11-23 19:19:53 +00:00
Corrected high card error for hands < 5 cards. Added discard to Player.
git-svn-id: file:///srv/svn/euler@51 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
3373f8f1f7
commit
ad80b41e06
1 changed files with 6 additions and 1 deletions
|
@ -176,6 +176,8 @@ class Hand:
|
|||
self.__rank = Hand.ONE_PAIR
|
||||
mvalues = [m[0] for m in multiples]
|
||||
self.__values = mvalues + [c.value for c in self.__cards if c.value not in mvalues]
|
||||
if not self.__rank:
|
||||
self.__rank = Hand.HIGH_CARD
|
||||
|
||||
return self.__rank
|
||||
def values(self):
|
||||
|
@ -349,6 +351,9 @@ class Player:
|
|||
|
||||
# Rebuild and re-evaluate hand
|
||||
self.__hand = Hand.create_best_hand([str(c) for c in self.__community_cards + self.__cards])
|
||||
def discard(self, index):
|
||||
self.__cards.pop(index)
|
||||
self.__hand = Hand.create_best_hand([str(c) for c in self.__community_cards + self.__cards])
|
||||
def hand(self):
|
||||
return self.__hand
|
||||
def __repr__(self):
|
||||
|
|
Loading…
Reference in a new issue