Advertisement
Jenssile

shuffling a dec of cards

Mar 8th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.28 KB | None | 0 0
  1. # NOTE you need the other paste bin called timerandomizer, and you need to save it to the same folder as .py
  2. from timerandomizer import tr1, tr2, tr3, tr4, tr5, tr6, tr7, tr8 # importing the different "randomizer's"
  3.  
  4. # complet list of cards.
  5. unsorteded = ["HartAce", "Hart2", "Hart3", "Hart4", "Hart5", "Hart6", "Hart7", "Hart8", "Hart9", "Hart10", "HartJack", "HartQueen", "HartKing", "SpadeAce", "Spade2", "Spade3", "Spade4", "Spade5", "Spade6", "Spade7", "Spade8", "Spade9", "Spade10", "SpadeJack", "SpadeQueen", "SpadeKing", "CloverAce", "Clover2", "Clover3", "Clover4", "Clover5", "Clover6", "Clover7", "Clover8", "Clover9", "Clover10", "CloverJack", "CloverQueen", "CloverKing", "DiamondAce", "Diamond2", "Diamond3", "Diamond4", "Diamond5", "Diamond6", "Diamond7", "Diamond8", "Diamond9", "Diamond10", "DiamondJack", "DiamondQueen", "DiamondKing"]
  6. final = []
  7. p1 = [] # player 1 hand
  8. sp1 = [] # payer 1 collection
  9. p2 = [] # player 2 hand
  10. sp2 = [] # player 2 collection
  11. p3 = [] # player 3 hand
  12. sp3 = [] # player 3 collection
  13. p4 = [] # palyer 4 hand
  14. sp4 = [] # player 4 collection
  15.  
  16. x = input("to start type 1 here: ") # to start
  17. i = 0 # counter for how many time i have to do some thing
  18.  
  19. # the printing I do that is not in the first if statement is so that I can see what is happening.
  20. # and I have only commented in the first manipulation of the card to save on time commenting.
  21.  
  22. n = tr5(x) # number of times it has to go and do the while loop
  23. print(n)
  24.  
  25. while i != n +2: # here I look at if my counter does not equal the number of times I want to shuffle the cards +2 (use +2 here so that it does not inter fear with anything.)
  26.     print(i)
  27.     if i == n +1: # here I look at if the counter is equal to the number of times it has to shuffle +1, if yes print the list
  28.         print(unsorteded)
  29.         break
  30.     elif i != n +1: # here I look at if the counter is not equal to the number of time it has to shuffle +1
  31.         o = tr1(i) # what is going to happen to the card being manipulated
  32.         if o == 0:
  33.             c = tr4(i) # which card is being manipulated
  34.             y = tr6(i) # the cards new postion
  35.             temp = unsorteded.pop(int(c)) # removes the card form the list and puts it in a temporary int
  36.             print(temp) # i have to print it or i cant insert it in the list for some reason.
  37.             unsorteded.insert(int(y), temp) # inserts the card in its new place
  38.             i = i +1 # adds one to the counter.
  39.         elif o == 1:
  40.             c = tr4(i)
  41.             y = tr7(i)
  42.             temp = unsorteded.pop(int(c))
  43.             print(temp)
  44.             unsorteded.insert(int(y), temp)
  45.             i = i +1
  46.         elif o == 2:
  47.             c = tr4(i)
  48.             y = tr8(i)
  49.             temp = unsorteded.pop(int(c))
  50.             print(temp)
  51.             unsorteded.insert(int(y), temp)
  52.             i = i +1
  53.         elif o == 3:
  54.             c = tr4(i)
  55.             temp = unsorteded.pop(int(c))
  56.             print(temp)
  57.             unsorteded.insert(-1, temp) # here i put the card in at -1 no matter what
  58.             i = i +1
  59.         elif o == 4:
  60.             c = tr4(i)
  61.             y = tr1(i)
  62.             temp = unsorteded.pop(int(c))
  63.             print(temp)
  64.             unsorteded.insert(-int(y), temp) # here it is a random -y value
  65.             i = i +1
  66.         elif o == 5:
  67.             c = tr4(i)
  68.             y = tr8(i)
  69.             temp = unsorteded.pop(int(c))
  70.             print(temp)
  71.             unsorteded.insert(-int(y), temp)
  72.             i = i +1
  73.         elif o == 6:
  74.             c = tr4(i)
  75.             y = tr6(i)
  76.             temp = unsorteded.pop(int(c))
  77.             print(temp)
  78.             unsorteded.insert(-int(y), temp)
  79.             i = i +1
  80.         elif o == 7:
  81.             c = tr4(i)
  82.             y = tr1(i)
  83.             temp = unsorteded.pop(int(c))
  84.             print(temp)
  85.             unsorteded.insert(int(y), temp)
  86.             i = i +1
  87.         elif o == 8:
  88.             c = tr4(i)
  89.             y = tr6(i)
  90.             temp = unsorteded.pop(int(c))
  91.             print(temp)
  92.             unsorteded.insert(int(y), temp)
  93.             i = i +1
  94.         elif o == 9:
  95.             c = tr4(i)
  96.             y = tr7(i)
  97.             temp = unsorteded.pop(int(c))
  98.             print(temp)
  99.             unsorteded.insert(int(y), temp)
  100.             i = i +1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement