...
 
Commits (2)
......@@ -8,7 +8,7 @@
# instatiation, which may fail if the given card list is neither empty nor
# contains exactly 5 cards.
#
# Tests :
# Tests :
# h = hand.Hand([Card(1,3), Card(1, 6), Card(1, 6), Card(1, 8), Card(2, 8)])
# h2 = hand.Hand([Card(1,10), Card(1, 6), Card(1, 6), Card(1, 8), Card(2, 8)])
# h.getHandName()
......@@ -37,8 +37,7 @@ class Hand:
self.__cards = cards[:]
self.__handName = HandName.HIGH_CARD
if len(self.__cards) == 5:
self.__cards.sort()
self.__cards.reverse()
self.__cards.sort(reverse=True)
self.__readHand()
def getHandName(self):
......
......@@ -30,7 +30,7 @@ class Card:
## The card must be instanciated with its suit and value, which won't
# change.
assert value >= 2 and value <= 14
self.__suit = suit
self.__suit = Suit
self.__value = value
self.__json = {}
if self.__suit == Suit.HEARTS : self.__json["Suit"] = "Hearts"
......@@ -50,7 +50,7 @@ class Card:
@property
def json(self):
return self.__json
def cardStr(self):
# Debug print
return '({0}:{1})'.format(self.__value, self.__suit)
......
......@@ -5,7 +5,7 @@
# one.
# The size of the deck is decreased by one for each drawn card, until none are
# left (drawCard will then fail).
#
#
from table import card
import random
......@@ -25,7 +25,7 @@ class Deck:
def reset(self):
self.__cards = []
for c in card.Color:
for c in card.Suit:
for i in range(2, 15):
self.__cards.append(card.Card(c, i))
random.shuffle(self.__cards)