X-Git-Url: https://git.armaanb.net/?a=blobdiff_plain;f=lightcards%2Fdeck.py;h=110c5b4fdcee15ab50a27c5eca2ea52dfa3a0ee7;hb=468d491893758e3b9ac532757ea98791303f4a6d;hp=2a612027ad00d5d7c61fc3b02d9c7d22e14e4b6d;hpb=61808c327216bcf1973ace53f9bbb679bd1b9309;p=lightcards.git diff --git a/lightcards/deck.py b/lightcards/deck.py index 2a61202..110c5b4 100644 --- a/lightcards/deck.py +++ b/lightcards/deck.py @@ -2,13 +2,21 @@ # Armaan Bhojwani 2021 -class Card(list): - """Card extends the list class, and adds ability to star them.""" +class Card: + """Class containing the card information.""" def __init__(self, inp): - super().__init__(inp) self.starred = False self.side = 0 + self.front = "" + self.back = "" + if len(inp) >= 1: + self.front = inp[0] + if len(inp) >= 2: + self.back = inp[1] + + def __str__(self): + return f"{self.front}, {self.back}" def unStar(self): self.starred = False @@ -37,6 +45,15 @@ class Card(list): def getSide(self): return self.side + def get(self): + if self.side == 0: + return self.front + else: + return self.back + + def getFront(self): + return self.front + def flip(self): if self.side == 0: self.side = 1 @@ -45,13 +62,13 @@ class Card(list): class Status: - """The status class keeps track of where in the deck the user is""" + """Keeps track of where in the deck the user is""" def __init__(self): self.index = 0 def forward(self, stack): - if not self.index == len(stack): + if self.index != len(stack): self.index += 1 def back(self):