Решение на Тесте карти от Кирил Киров

Обратно към всички решения

Към профила на Кирил Киров

Резултати

  • 9 точки от тестове
  • 0 бонус точки
  • 9 точки общо
  • 14 успешни тест(а)
  • 2 неуспешни тест(а)

Код

from collections import OrderedDict
class Rank:
_symbol = []
def __init__(self, card_symbol):
self._symbol = card_symbol
def __eq__(self, other):
return self._symbol == other._symbol
def __str__(self):
return self._symbol
class Suit:
__color = []
def __init__(self, card_color):
self.__color = card_color
def __eq__(self, other):
return self.__color == other.__color
def __str__(self):
return self.__color
class Two(Rank):
def __init__(self):
Rank.__init__(self, 'Two')
class Three(Rank):
def __init__(self):
Rank.__init__(self, 'Three')
class Four(Rank):
def __init__(self):
Rank.__init__(self, 'Four')
class Five(Rank):
def __init__(self):
Rank.__init__(self, 'Five')
class Six(Rank):
def __init__(self):
Rank.__init__(self, 'Six')
class Seven(Rank):
def __init__(self):
Rank.__init__(self, 'Seven')
class Eight(Rank):
def __init__(self):
Rank.__init__(self, 'Eight')
class Nine(Rank):
def __init__(self):
Rank.__init__(self, 'Nine')
class Ten(Rank):
def __init__(self):
Rank.__init__(self, 'Ten')
class King(Rank):
def __init__(self):
Rank.__init__(self, 'King')
class Jack(Rank):
def __init__(self):
Rank.__init__(self, 'Jack')
class Queen(Rank):
def __init__(self):
Rank.__init__(self, 'Queen')
class Ace(Rank):
def __init__(self):
Rank.__init__(self, 'Ace')
class Clubs(Suit):
def __init__(self):
Suit.__init__(self, 'Clubs')
class Diamonds(Suit):
def __init__(self):
Suit.__init__(self, 'Diamonds')
class Hearts(Suit):
def __init__(self):
Suit.__init__(self, 'Hearts')
class Spades(Suit):
def __init__(self):
Suit.__init__(self, 'Spades')
RANKS = {'King': King, 'Queen': Queen, 'Jack': Jack, 'Ten': Ten,
'Nine': Nine, 'Eight': Eight, 'Seven': Seven,
'Six': Six, 'Five': Five, 'Four': Four, 'Three': Three, 'Two': Two, 'Ace': Ace,
}
def RankOrdered():
ranks = OrderedDict()
ranks['King'] = King
ranks['Queen'] = Queen
ranks['Jack'] = Jack
ranks['Ten'] = Ten
ranks['Nine'] = Nine
ranks['Eight'] = Eight
ranks['Seven'] = Seven
ranks['Six'] = Six
ranks['Five'] = Five
ranks['Four'] = Four
ranks['Three'] = Three
ranks['Two'] = Two
ranks['Ace'] = Ace
return ranks
SUITS = {'Clubs': Clubs, 'Diamonds': Diamonds,
'Hearts': Hearts, 'Spades': Spades}
def suitsOrdered():
suits = OrderedDict()
suits['Diamonds'] = Diamonds
suits['Clubs'] = Clubs
suits['Hearts'] = Hearts
suits['Spades'] = Spades
return suits
class Card(Rank, Suit):
rank = []
suit = []
def __init__(self, rank, suit):
self.rank = rank()
self.suit = suit()
# def __getattr__(self,name):
# if name == ran
def __str__(self):
return '{} of {}'.format(self.rank, self.suit)
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
class CardCollection(Card):
collection_cards = OrderedDict()
def __init__(self, collection=[]):
self.collection_cards = collection
def draw(self, index):
ret_card = self.collection_cards[index]
self.collection_cards.pop(index)
return ret_card
def draw_from_top(self):
ret_card = self.collection_cards[len(self.collection_cards) - 1]
self.collection_cards.pop(len(self.collection_cards) - 1)
return ret_card
def draw_from_bottom(self):
ret_card = self.collection_cards[0]
self.collection_cards.pop(0)
return ret_card
def top_card(self):
return self.collection_cards[len(self.collection_cards) - 1]
def bottom_card(self):
return self.collection_cards[0]
def add(self, card):
self.collection_cards.append(card)
def index(self, card):
return self.collection_cards.index(card)
def __getitem__(self, index):
return self.collection_cards[index]
def __len__(self):
return len(self.collection_cards)
def __str__(self): # ;)
result = [str(i) for i in self.collection_cards]
return str(result)
def StandardDeck():
suits = suitsOrdered()
ranks = RankOrdered()
deck = [str(Card(rank, suit)) for suit in suits.values()
for rank in ranks.values()]
#StandardDeckCollection = CardCollection(deck)
return CardCollection(deck)
def BeloteDeck():
deck = []
suits = suitsOrdered()
ranks = RankOrdered()
for suit in suits.values():
for rank in ranks.values():
if Card(
rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit)]:
deck.append(Card(rank, suit))
#BeloteDeckCollection = CardCollection(deck)
return CardCollection(deck)
def SixtySixDeck():
deck = []
suits = suitsOrdered()
ranks = RankOrdered()
for suit in suits.values():
for rank in ranks.values():
if Card(
rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit), Card(RANKS['Seven'], suit), Card(RANKS['Eight'], suit)]:
deck.append(Card(rank, suit))
#SixtySixDeckCollection = CardCollection(deck)
return CardCollection(deck)

Лог от изпълнението

...F.F..........
======================================================================
FAIL: test_deck_index (test.CardCollectionTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lib/language/python/runner.py", line 60, in thread
    raise it.exc_info[1]
  File "lib/language/python/runner.py", line 48, in run
    self.result = func(*args, **kwargs)
  File "/tmp/d20140407-19315-12265o0/test.py", line 160, in test_deck_index
    self.assertEqual(0, deck.index(card1))
AssertionError: 0 != 2

======================================================================
FAIL: test_deck_order (test.CardCollectionTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lib/language/python/runner.py", line 60, in thread
    raise it.exc_info[1]
  File "lib/language/python/runner.py", line 48, in run
    self.result = func(*args, **kwargs)
  File "/tmp/d20140407-19315-12265o0/test.py", line 134, in test_deck_order
    self.assertEqual(deck.bottom_card(), card1)
AssertionError: <solution.Card object at 0xb778bf6c> != <solution.Card object at 0xb77a630c>

----------------------------------------------------------------------
Ran 16 tests in 0.030s

FAILED (failures=2)

История (3 версии и 2 коментара)

Кирил обнови решението на 24.03.2014 00:29 (преди около 10 години)

+
+
+
+
+class Rank:
+ _symbol = []
+
+ def __init__(self, card_symbol):
+ self._symbol = card_symbol
+
+ def __eq__(self, other):
+ return self._symbol == other._symbol
+
+ def __str__(self):
+ return self._symbol
+
+
+class Suit:
+ __color = []
+
+ def __init__(self, card_color):
+ self.__color = card_color
+
+ def __eq__(self,other):
+ return self.__color == other.__color
+
+ def __str__(self):
+ return self.__color
+
+
+
+class Two(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Two')
+
+
+class Three(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Three')
+
+
+class Four(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Four')
+
+
+class Five(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Five')
+
+
+class Six(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Six')
+
+
+class Seven(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Seven')
+
+
+class Eight(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Eight')
+
+
+class Nine(Rank):
+
+ def __init__(self):
+ Rank.__init__(self,'Nine')
+
+
+class Ten(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Ten')
+
+
+class King(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'King')
+
+
+class Jack(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Jack')
+
+
+class Queen(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Queen')
+
+
+class Ace(Rank):
+
+ def __init__(self):
+ Rank.__init__(self, 'Ace')
+
+
+
+
+
+class Clubs(Suit):
+
+ def __init__(self):
+ Suit.__init__(self, 'Clubs')
+
+
+class Diamonds(Suit):
+
+ def __init__(self):
+ Suit.__init__(self, 'Diamonds')
+
+
+class Hearts(Suit):
+
+ def __init__(self):
+ Suit.__init__(self, 'Hearts')
+
+
+class Spades(Suit):
+
+ def __init__(self):
+ Suit.__init__(self, 'Spades')
+
+
+RANKS = {'Queen': Queen, 'Ace': Ace, 'Two': Two,
+'Seven': Seven, 'Jack': Jack, 'Three': Three, 'Five': Five,
+'Six': Six, 'Four': Four, 'Nine': Nine, 'King': King, 'Ten': Ten,
+'Eight': Eight}
+
+SUITS = {'Clubs': Clubs, 'Diamonds': Diamonds,
+ 'Hearts': Hearts, 'Spades': Spades}
+
+class Card(Rank, Suit):
+ rank = []
+ suit = []
+
+ def __init__(self, rank, suit):
+ self.rank = rank()
+ self.suit = suit()
+ # def __getattr__(self,name):
+ # if name == ran
+
+ def __str__(self):
+ return '{} of {}'.format(self.rank, self.suit)
+
+ def __eq__(self, other):
+ return self.rank == other.rank and self.suit == other.suit
+
+
+class CardCollection(Card):
+ collection_cards = []
+
+ def __init__(self, collection):
+ self.collection_cards = collection
+
+ def draw(self, index):
+ ret_card = self.collection_cards[index]
+ self.collection_cards.pop(index)
+ return ret_card
+
+ def draw_from_top(self):
+ ret_card = self.collection_cards[len(self.collection_cards) - 1]
+ self.collection_cards.pop(len(self.collection_cards) - 1)
+ return ret_card
+
+ def draw_from_bottom(self):
+ ret_card = self.collection_cards[0]
+ self.collection_cards.pop(0)
+ return ret_card
+
+ def top_card(self):
+ return self.collection_cards[len(self.collection_cards) - 1]
+
+ def bottom_card(self):
+ return self.collection_cards[0]
+
+ def add(self, card):
+ self.collection_cards.append(card)
+
+ def index(self, card):
+ return self.collection_cards.index(card)
+
+ def __getitem__(self, index):
+ return str(self.collection_cards[index])
+
+def StandardDeck():
+ deck = [Card(rank, suit) for rank in RANKS.values()
+ for suit in SUITS.values()]
+ return deck
+def BeloteDeck():
+ deck = []
+ for suit in SUITS.values():
+ for rank in RANKS.values():
+ if Card(rank,suit) not in [Card(RANKS['Two'],suit),Card(RANKS['Three'],suit),
+ Card(RANKS['Four'],suit),Card(RANKS['Five'],suit),Card(RANKS['Six'],suit)] :
+ deck.append(Card(rank,suit))
+ return deck
+
+def SixtySixDeck():
+ deck = []
+ for suit in SUITS.values():
+ for rank in RANKS.values():
+ if Card(rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
+ Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit), Card(RANKS['Seven'], suit), Card(RANKS['Eight'], suit)]:
+ deck.append(Card(rank, suit))
+ print(1)
+ return deck
+
+deck = [Card(rank, suit) for rank in RANKS.values()
+ for suit in SUITS.values()]
+
+
+
+
+
+
+
+
+
+

Махни това от ред 220. Не забравяй да си махаш кода с който си тестваш защото може да ни попречи на оценяването.

Освен това си погледни стандартните тестета -- всеки път изкарват картите в различен ред ;)

Кирил обнови решението на 25.03.2014 10:26 (преди около 10 години)

-
-
-
-
+from collections import OrderedDict
class Rank:
_symbol = []
def __init__(self, card_symbol):
self._symbol = card_symbol
def __eq__(self, other):
return self._symbol == other._symbol
def __str__(self):
return self._symbol
class Suit:
__color = []
def __init__(self, card_color):
self.__color = card_color
def __eq__(self,other):
return self.__color == other.__color
def __str__(self):
return self.__color
class Two(Rank):
def __init__(self):
Rank.__init__(self, 'Two')
class Three(Rank):
def __init__(self):
Rank.__init__(self, 'Three')
class Four(Rank):
def __init__(self):
Rank.__init__(self, 'Four')
class Five(Rank):
def __init__(self):
Rank.__init__(self, 'Five')
class Six(Rank):
def __init__(self):
Rank.__init__(self, 'Six')
class Seven(Rank):
def __init__(self):
Rank.__init__(self, 'Seven')
class Eight(Rank):
def __init__(self):
Rank.__init__(self, 'Eight')
class Nine(Rank):
def __init__(self):
Rank.__init__(self,'Nine')
class Ten(Rank):
def __init__(self):
Rank.__init__(self, 'Ten')
class King(Rank):
def __init__(self):
Rank.__init__(self, 'King')
class Jack(Rank):
def __init__(self):
Rank.__init__(self, 'Jack')
class Queen(Rank):
def __init__(self):
Rank.__init__(self, 'Queen')
class Ace(Rank):
def __init__(self):
Rank.__init__(self, 'Ace')
class Clubs(Suit):
def __init__(self):
Suit.__init__(self, 'Clubs')
class Diamonds(Suit):
def __init__(self):
Suit.__init__(self, 'Diamonds')
class Hearts(Suit):
def __init__(self):
Suit.__init__(self, 'Hearts')
class Spades(Suit):
def __init__(self):
Suit.__init__(self, 'Spades')
-RANKS = {'Queen': Queen, 'Ace': Ace, 'Two': Two,
-'Seven': Seven, 'Jack': Jack, 'Three': Three, 'Five': Five,
-'Six': Six, 'Four': Four, 'Nine': Nine, 'King': King, 'Ten': Ten,
-'Eight': Eight}
+RANKS = {'King': King,'Queen': Queen,'Jack': Jack,'Ten': Ten,
+ 'Nine': Nine,'Eight': Eight,'Seven': Seven,
+'Six': Six, 'Five': Five,'Four': Four, 'Three': Three, 'Two': Two,'Ace': Ace,
+}
+
+def RankOrdered():
+ ranks=OrderedDict()
+ ranks['King'] =King
+ ranks['Queen']= Queen
+ ranks['Jack'] = Jack
+ ranks['Ten'] = Ten
+ ranks['Nine'] = Nine
+ ranks['Eight']= Eight
+ ranks['Seven']= Seven
+ ranks['Six'] = Six
+ ranks['Five'] = Five
+ ranks['Four'] = Four
+ ranks['Three']= Three
+ ranks['Two'] = Two
+ ranks['Ace'] = Ace
+ return ranks
+
+
SUITS = {'Clubs': Clubs, 'Diamonds': Diamonds,
'Hearts': Hearts, 'Spades': Spades}
+def suitsOrdered():
+ suits=OrderedDict()
+ suits['Diamonds']=Diamonds
+ suits['Clubs']=Clubs
+ suits['Hearts']=Hearts
+ suits['Spades']=Spades
+ return suits
+
class Card(Rank, Suit):
rank = []
suit = []
def __init__(self, rank, suit):
self.rank = rank()
self.suit = suit()
# def __getattr__(self,name):
# if name == ran
def __str__(self):
return '{} of {}'.format(self.rank, self.suit)
def __eq__(self, other):
return self.rank == other.rank and self.suit == other.suit
class CardCollection(Card):
collection_cards = []
- def __init__(self, collection):
+ def __init__(self, collection=[]):
self.collection_cards = collection
def draw(self, index):
ret_card = self.collection_cards[index]
self.collection_cards.pop(index)
return ret_card
def draw_from_top(self):
ret_card = self.collection_cards[len(self.collection_cards) - 1]
self.collection_cards.pop(len(self.collection_cards) - 1)
return ret_card
def draw_from_bottom(self):
ret_card = self.collection_cards[0]
self.collection_cards.pop(0)
return ret_card
def top_card(self):
return self.collection_cards[len(self.collection_cards) - 1]
def bottom_card(self):
return self.collection_cards[0]
def add(self, card):
self.collection_cards.append(card)
def index(self, card):
return self.collection_cards.index(card)
def __getitem__(self, index):
- return str(self.collection_cards[index])
+ return self.collection_cards[index]
+ def __len__(self):
+ return len(self.collection_cards)
+
def StandardDeck():
- deck = [Card(rank, suit) for rank in RANKS.values()
- for suit in SUITS.values()]
+ suits=suitsOrdered()
+ ranks=RankOrdered()
+ deck = [str(Card(rank, suit)) for suit in suits.values()
+ for rank in ranks.values()]
return deck
+
def BeloteDeck():
deck = []
- for suit in SUITS.values():
- for rank in RANKS.values():
+ suits=suitsOrdered()
+ ranks=RankOrdered()
+ for suit in suits.values():
+ for rank in ranks.values():
if Card(rank,suit) not in [Card(RANKS['Two'],suit),Card(RANKS['Three'],suit),
- Card(RANKS['Four'],suit),Card(RANKS['Five'],suit),Card(RANKS['Six'],suit)] :
- deck.append(Card(rank,suit))
+ Card(RANKS['Four'],suit),Card(RANKS['Five'],suit),Card(RANKS['Six'],suit)] :
+ deck.append(str(Card(rank,suit)))
return deck
def SixtySixDeck():
deck = []
- for suit in SUITS.values():
- for rank in RANKS.values():
+ suits=suitsOrdered()
+ ranks=RankOrdered()
+ for suit in suits.values():
+ for rank in ranks.values():
if Card(rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit), Card(RANKS['Seven'], suit), Card(RANKS['Eight'], suit)]:
- deck.append(Card(rank, suit))
- print(1)
+ deck.append(str(Card(rank, suit)))
return deck
-
-deck = [Card(rank, suit) for rank in RANKS.values()
- for suit in SUITS.values()]
-
-
-
-
-
-
-
-
-

Кирил обнови решението на 25.03.2014 18:01 (преди около 10 години)

from collections import OrderedDict
+
+
class Rank:
_symbol = []
def __init__(self, card_symbol):
self._symbol = card_symbol
def __eq__(self, other):
return self._symbol == other._symbol
def __str__(self):
return self._symbol
class Suit:
__color = []
def __init__(self, card_color):
self.__color = card_color
- def __eq__(self,other):
+ def __eq__(self, other):
return self.__color == other.__color
def __str__(self):
return self.__color
-
class Two(Rank):
def __init__(self):
Rank.__init__(self, 'Two')
class Three(Rank):
def __init__(self):
Rank.__init__(self, 'Three')
class Four(Rank):
def __init__(self):
Rank.__init__(self, 'Four')
class Five(Rank):
def __init__(self):
Rank.__init__(self, 'Five')
class Six(Rank):
def __init__(self):
Rank.__init__(self, 'Six')
class Seven(Rank):
def __init__(self):
Rank.__init__(self, 'Seven')
class Eight(Rank):
def __init__(self):
Rank.__init__(self, 'Eight')
class Nine(Rank):
def __init__(self):
- Rank.__init__(self,'Nine')
+ Rank.__init__(self, 'Nine')
class Ten(Rank):
def __init__(self):
Rank.__init__(self, 'Ten')
class King(Rank):
def __init__(self):
Rank.__init__(self, 'King')
class Jack(Rank):
def __init__(self):
Rank.__init__(self, 'Jack')
class Queen(Rank):
def __init__(self):
Rank.__init__(self, 'Queen')
class Ace(Rank):
def __init__(self):
Rank.__init__(self, 'Ace')
-
-
-
class Clubs(Suit):
def __init__(self):
Suit.__init__(self, 'Clubs')
class Diamonds(Suit):
def __init__(self):
Suit.__init__(self, 'Diamonds')
class Hearts(Suit):
def __init__(self):
Suit.__init__(self, 'Hearts')
class Spades(Suit):
def __init__(self):
Suit.__init__(self, 'Spades')
+RANKS = {'King': King, 'Queen': Queen, 'Jack': Jack, 'Ten': Ten,
+ 'Nine': Nine, 'Eight': Eight, 'Seven': Seven,
+ 'Six': Six, 'Five': Five, 'Four': Four, 'Three': Three, 'Two': Two, 'Ace': Ace,
+ }
-RANKS = {'King': King,'Queen': Queen,'Jack': Jack,'Ten': Ten,
- 'Nine': Nine,'Eight': Eight,'Seven': Seven,
-'Six': Six, 'Five': Five,'Four': Four, 'Three': Three, 'Two': Two,'Ace': Ace,
-}
-
def RankOrdered():
- ranks=OrderedDict()
- ranks['King'] =King
- ranks['Queen']= Queen
+ ranks = OrderedDict()
+ ranks['King'] = King
+ ranks['Queen'] = Queen
ranks['Jack'] = Jack
- ranks['Ten'] = Ten
+ ranks['Ten'] = Ten
ranks['Nine'] = Nine
- ranks['Eight']= Eight
- ranks['Seven']= Seven
- ranks['Six'] = Six
+ ranks['Eight'] = Eight
+ ranks['Seven'] = Seven
+ ranks['Six'] = Six
ranks['Five'] = Five
ranks['Four'] = Four
- ranks['Three']= Three
- ranks['Two'] = Two
- ranks['Ace'] = Ace
+ ranks['Three'] = Three
+ ranks['Two'] = Two
+ ranks['Ace'] = Ace
return ranks
SUITS = {'Clubs': Clubs, 'Diamonds': Diamonds,
'Hearts': Hearts, 'Spades': Spades}
-def suitsOrdered():
- suits=OrderedDict()
- suits['Diamonds']=Diamonds
- suits['Clubs']=Clubs
- suits['Hearts']=Hearts
- suits['Spades']=Spades
+
+def suitsOrdered():
+ suits = OrderedDict()
+ suits['Diamonds'] = Diamonds
+ suits['Clubs'] = Clubs
+ suits['Hearts'] = Hearts
+ suits['Spades'] = Spades
return suits
+
class Card(Rank, Suit):
rank = []
suit = []
def __init__(self, rank, suit):
self.rank = rank()
self.suit = suit()
# def __getattr__(self,name):
# if name == ran
def __str__(self):
return '{} of {}'.format(self.rank, self.suit)
def __eq__(self, other):
- return self.rank == other.rank and self.suit == other.suit
+ return self.rank == other.rank and self.suit == other.suit
class CardCollection(Card):
- collection_cards = []
+ collection_cards = OrderedDict()
def __init__(self, collection=[]):
self.collection_cards = collection
def draw(self, index):
ret_card = self.collection_cards[index]
self.collection_cards.pop(index)
return ret_card
def draw_from_top(self):
ret_card = self.collection_cards[len(self.collection_cards) - 1]
self.collection_cards.pop(len(self.collection_cards) - 1)
return ret_card
def draw_from_bottom(self):
ret_card = self.collection_cards[0]
self.collection_cards.pop(0)
return ret_card
def top_card(self):
return self.collection_cards[len(self.collection_cards) - 1]
def bottom_card(self):
return self.collection_cards[0]
def add(self, card):
self.collection_cards.append(card)
def index(self, card):
return self.collection_cards.index(card)
def __getitem__(self, index):
return self.collection_cards[index]
def __len__(self):
return len(self.collection_cards)
+ def __str__(self): # ;)
+
+ result = [str(i) for i in self.collection_cards]
+ return str(result)
+
+
def StandardDeck():
- suits=suitsOrdered()
- ranks=RankOrdered()
+ suits = suitsOrdered()
+ ranks = RankOrdered()
deck = [str(Card(rank, suit)) for suit in suits.values()
- for rank in ranks.values()]
- return deck
+ for rank in ranks.values()]
+ #StandardDeckCollection = CardCollection(deck)
+ return CardCollection(deck)
+
def BeloteDeck():
deck = []
- suits=suitsOrdered()
- ranks=RankOrdered()
+ suits = suitsOrdered()
+ ranks = RankOrdered()
for suit in suits.values():
for rank in ranks.values():
- if Card(rank,suit) not in [Card(RANKS['Two'],suit),Card(RANKS['Three'],suit),
- Card(RANKS['Four'],suit),Card(RANKS['Five'],suit),Card(RANKS['Six'],suit)] :
- deck.append(str(Card(rank,suit)))
- return deck
+ if Card(
+ rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
+ Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit)]:
+ deck.append(Card(rank, suit))
+ #BeloteDeckCollection = CardCollection(deck)
+ return CardCollection(deck)
+
def SixtySixDeck():
deck = []
- suits=suitsOrdered()
- ranks=RankOrdered()
+ suits = suitsOrdered()
+ ranks = RankOrdered()
for suit in suits.values():
- for rank in ranks.values():
- if Card(rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
+ for rank in ranks.values():
- Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit), Card(RANKS['Seven'], suit), Card(RANKS['Eight'], suit)]:
+ if Card(
- deck.append(str(Card(rank, suit)))
+ rank, suit) not in [Card(RANKS['Two'], suit), Card(RANKS['Three'], suit),
- return deck
+ Card(RANKS['Four'], suit), Card(RANKS['Five'], suit), Card(RANKS['Six'], suit), Card(RANKS['Seven'], suit), Card(RANKS['Eight'], suit)]:
-
+ deck.append(Card(rank, suit))
+ #SixtySixDeckCollection = CardCollection(deck)
+ return CardCollection(deck)