Monday, June 18, 2012

Create your own Magic 8 Ball script



Magic 8 Ball is a toy you can use to seek advices when you are bored or need to make some tough decisions but you cannot ask anybody else, even your parents, siblings, friends or your cat. There are a lot of Magic 8 Ball tools out there, both online and offline, but you can create your own Magic 8 Ball script with your unique answers very easily.

Here is a simple Magic 8 Ball script in python, if you dont like these answer, just edit the script to add whatever answers you prefer:

#!/usr/bin/env python  
 # Magic 8 ball program  
 import random  
 answers = ["As I see it, yes","It is certain","It is decidedly so","Most likely","Outlook good","Signs point to yes","Without a doubt","Yes","Yes definitely","You may rely on it","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful"]  
 raw_input("Hello candy-ass, what you need to know?\n")  
 response = random.choice(answers)  
 print response +'\n'  
 while (True):  
  raw_input("Any other question?\n")  
  print random.choice(answers) + '\n'  

To use this script, just copy paste the script into a text file and save it as a python script with the .py extension. For example, my script is m8.py and I saved it on the desktop. Next, you will need to make the script executable:

 sudo chmod +x m8.py  

After that you just need to double click on the file and choose to run it in the terminal:

magic 8 ball script linux

And here is how the script works:

python magic 8 ball script linux


No comments:

Post a Comment