Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def shuffleONE(self, no):
- s1 = Stack()
- s2 = Stack()
- count = 0
- count2 = 0
- remainder = 52 - no
- while count < no: # moving from deck to s1
- card_to_s1 = self.cards.pop()
- s1.push(card_top_s1)
- count += 1
- while count2 < remainder: # moving remainder from deck to s2
- card_to_s2 = self.cards.pop()
- s2.push(card_to_s2)
- count2 += 1
- size_1 = s1.size()
- size_2 = s2.size()
- if size_1 >= size_2: # if s1 is bigger than s2
- s1_to_deck = s1.pop()
- s2_to_deck = s2.pop()
- self.cards.push(s1_to_deck)
- self.cards.push(s2_to_deck)
- elif size_2 >= size_1: #if s2 is bigger than s1
- s2_to_deck = s2.pop()
- s1_to_deck = s1.pop()
- self.cards.push(s2_to_deck)
- self.cards.push(s1_to_deck)
- return self.cards
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement