timber101

Magic 8 Ball / Mystic Meg

Apr 12th, 2021
639
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #  Magic 8 Ball Game - Mystic Meg
  2.  
  3. from sense_hat import SenseHat # Capital S and H needed
  4. from random import choice
  5. from time import sleep
  6.  
  7. sense= SenseHat()
  8.  
  9. #print("Ask me a question >> ")
  10.  
  11. sense.show_message("Ask me a question >> ", scroll_speed = 0.06)
  12.  
  13. sleep (3)  # 3 second delay
  14.  
  15. replies = ["I'm not sure",
  16.     "most definitely",
  17.     "Hmm let me think about that",
  18.     "Looking Good",
  19.     "Signs point to yes",
  20.     "Not a chance",
  21.     "I think thats a posibility",
  22.     "Better ask someone else!"]
  23. """
  24. while True:
  25.  x, y, z = sense.get_accelerometer_raw().values()
  26.  
  27.  x = abs(x)
  28.  y = abs(y)
  29.  z = abs(z)
  30.    
  31. #print(choice(replies))
  32.  if x>2 or y>2 or z >2 :
  33.    
  34.  else:
  35.    sense.clear()
  36. """
  37.  
  38.  
  39. while True:
  40.   for event in sense.stick.get_events():
  41.     # Check if the joystick was pressed
  42.     if event.action == "pressed":
  43.       sense.show_message(choice(replies), scroll_speed = 0.06)
  44.     else:
  45.       sense.clear()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×