def isGameWon(self): if len(self.s.talon.cards): return 0 for s in self.s.rows: if (len(s.cards) != 4 or not cardsFaceUp(s.cards) or not s.isHanafudaSequence(s.cards, self.Strictness)): return 0 return 1
def isHanafudaSequence(self, s, strictness=1): for i in range(len(s) - 1): if s[i].suit != s[i + 1].suit: return 0 if s[i].suit == 10 or strictness: a, b = s[i].rank, s[i + 1].rank else: a, b = self.swapTrashCards(s[i], s[i + 1]) if a + 1 != b: return 0 return cardsFaceUp(s)