Advertisement
Guest User

Untitled

a guest
Apr 27th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. def shuffleONE(self, no):
  2. s1 = Stack()
  3. s2 = Stack()
  4. count = 0
  5. count2 = 0
  6. remainder = 52 - no
  7. while count < no: # moving from deck to s1
  8. card_to_s1 = self.cards.pop()
  9. s1.push(card_top_s1)
  10. count += 1
  11. while count2 < remainder: # moving remainder from deck to s2
  12. card_to_s2 = self.cards.pop()
  13. s2.push(card_to_s2)
  14. count2 += 1
  15. size_1 = s1.size()
  16. size_2 = s2.size()
  17. if size_1 >= size_2: # if s1 is bigger than s2
  18. s1_to_deck = s1.pop()
  19. s2_to_deck = s2.pop()
  20. self.cards.push(s1_to_deck)
  21. self.cards.push(s2_to_deck)
  22. elif size_2 >= size_1: #if s2 is bigger than s1
  23. s2_to_deck = s2.pop()
  24. s1_to_deck = s1.pop()
  25. self.cards.push(s2_to_deck)
  26. self.cards.push(s1_to_deck)
  27. return self.cards
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement