Allowing a hand to be anything between 1 and 5 cards. This will allow

for improvement probability calculations and such, as well as ranking
    smaller hands for games like chinese poker.


git-svn-id: file:///srv/svn/euler@13 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
Correl Roush 2010-04-01 03:59:16 +00:00
parent 987dc151cf
commit 519824caee

View file

@ -62,7 +62,7 @@ class Hand:
'Royal Flush' 'Royal Flush'
] ]
def __init__(self, cards): def __init__(self, cards):
if len(cards) != 5: if len(cards) < 1 or len(cards) > 5:
raise InvalidHand(cards) raise InvalidHand(cards)
self.__rank = None self.__rank = None
self.__cards = sorted([Card(c) for c in cards], reverse=True) self.__cards = sorted([Card(c) for c in cards], reverse=True)