MCPcopy Index your code
hub / github.com/geekcomputers/Python / Card

Class Card

BlackJack_game/blackjack_simulate.py:44–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43
44class Card:
45 __slots__ = "suit", "rank", "is_face"
46
47 def __init__(self, suit, rank, face=True):
48 """
49 :param suit: pattern in the card
50 :param rank: point in the card
51 :param face: show or cover the face(point & pattern on it)
52 """
53 self.suit = suit
54 self.rank = rank
55 self.is_face = face
56
57 def __repr__(self):
58 fmt_card = "\t<rank: {rank:2}, suit: {suit:8}>"
59 if self.is_face:
60 return fmt_card.format(suit=self.suit, rank=self.rank)
61 return fmt_card.format(suit="*-Back-*", rank="*-Back-*")
62
63 def show(self):
64 print(str(self))
65
66
67class Deck:

Callers 1

builtMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected