Advertisement
asweigart

3 card monte program

Jul 12th, 2022
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. import random, time
  2.  
  3. print('Three Card Monte')
  4. print()
  5. print()
  6. print(' ___ ___ ___')
  7. print('|Q | |8 | |K |')
  8. print('| ♥ | | ♠ | | ♣ |')
  9. print('|__Q| |__8| |__K|')
  10. print()
  11. print('Keep an eye on the Queen of Hearts: left-middle-right')
  12. print('Press Enter to begin...')
  13. input()
  14.  
  15. # 0 1 2
  16. cards = ['Q', '8', 'K']
  17.  
  18. for i in range(1600):
  19. swap = random.choice(['LM', 'LR', 'MR', 'ML', 'RL', 'RM'])
  20. if swap == 'LM':
  21. cards[0], cards[1] = cards[1], cards[0]
  22. print('swapping left and middle...')
  23. elif swap == 'LR':
  24. cards[0], cards[2] = cards[2], cards[0]
  25. print('swapping left and right...')
  26. elif swap == 'MR':
  27. cards[1], cards[2] = cards[2], cards[1]
  28. print('swapping middle and right...')
  29. elif swap == 'ML':
  30. cards[1], cards[0] = cards[0], cards[1]
  31. print('swapping middle and left...')
  32. elif swap == 'RL':
  33. cards[2], cards[0] = cards[0], cards[2]
  34. print('swapping right and left...')
  35. elif swap == 'RM':
  36. cards[2], cards[1] = cards[1], cards[2]
  37. print('swapping right and middle...')
  38. time.sleep(0)
  39.  
  40. #print('DEBUG', cards)
  41. print('Where is the Queen of Hearts?')
  42. print('Enter L, M, or R for left, middle, or right:')
  43. guess = input().upper()
  44.  
  45. if guess == 'L' and cards[0] == 'Q':
  46. print('You won!')
  47. elif guess == 'M' and cards[1] == 'Q':
  48. print('You won!')
  49. elif guess == 'R' and cards[2] == 'Q':
  50. print('You won!')
  51. else:
  52. print('You lost. :(')
  53. print('Here are the cards:')
  54. if cards == ['Q', '8', 'K']:
  55. print(' ___ ___ ___')
  56. print('|Q | |8 | |K |')
  57. print('| ♥ | | ♠ | | ♣ |')
  58. print('|__Q| |__8| |__K|')
  59. elif cards == ['Q', 'K', '8']:
  60. print(' ___ ___ ___')
  61. print('|Q | |K | |8 |')
  62. print('| ♥ | | ♣ | | ♠ |')
  63. print('|__Q| |__K| |__8|')
  64. elif cards == ['K', 'Q', '8']:
  65. print(' ___ ___ ___')
  66. print('|K | |Q | |8 |')
  67. print('| ♣ | | ♥ | | ♠ |')
  68. print('|__K| |__Q| |__8|')
  69. elif cards == ['K', '8', 'Q']:
  70. print(' ___ ___ ___')
  71. print('|K | |8 | |Q |')
  72. print('| ♣ | | ♠ | | ♥ |')
  73. print('|__K| |__8| |__Q|')
  74. elif cards == ['8', 'K', 'Q']:
  75. print(' ___ ___ ___')
  76. print('|8 | |K | |Q |')
  77. print('| ♠ | | ♣ | | ♥ |')
  78. print('|__8| |__K| |__Q|')
  79. elif cards == ['8', 'Q', 'K']:
  80. print(' ___ ___ ___')
  81. print('|8 | |Q | |K |')
  82. print('| ♠ | | ♥ | | ♣ |')
  83. print('|__8| |__Q| |__K|')
  84.  
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement