def dealCards(self, sound=False): if self.cards: return DealRowTalonStack.dealCards(self, sound=sound) if sound: self.game.startDealSample() game, num_cards = self.game, len(self.cards) rows = list(game.s.rows)[:] rows.reverse() for r in rows: while r.cards: num_cards = num_cards + 1 game.moveMove(1, r, self, frames=4) if self.cards[-1].face_up: game.flipMove(self) assert len(self.cards) == num_cards n = DealRowTalonStack.dealCards(self, sound=False) if sound: self.game.stopSamples() return n
def dealCards(self, sound=False): game = self.game if game.cards_dealt == game.DEALS_BEFORE_SHUFFLE: if self.round < self.max_rounds: old_state = game.enterState(game.S_FILL) game.saveStateMove(2 | 16) # for undo self.game.cards_dealt = 0 game.saveStateMove(1 | 16) # for redo game.leaveState(old_state) self.redealCards() else: return False old_state = game.enterState(game.S_FILL) game.saveStateMove(2 | 16) # for undo self.game.cards_dealt += 1 game.saveStateMove(1 | 16) # for redo game.leaveState(old_state) return DealRowTalonStack.dealCards(self, sound)