Here is a very simple magic 8-ball program I made in Python (2.6.2). It has funny answers. Owned. And sorry about the screwed up indents, you will need to fix those yourself, I'm too lazy atm.
--------------------------------------------------------------------------------------------------
import random
dice = ("Without a doubt",
"It is certain",
"Maybe",
"Yes",
"All signs point to 23",
"No",
"Erm...no",
"Try asking again",
"You should probably diffuse the bomb beneath your chair.",
"Confucious says 'No'",
"42")
while True:
choice = raw_input("Type 'ask' to ask a question. "
"Type 'info' for information. "
"Type 'quit' to quit.\n").lower()
if choice == "ask":
raw_input("Please enter your question:\n")
roll = random.randrange(0, len(dice))
print dice[roll]
elif choice == "info":
print ("To use the Magic 8-Ball, type 'ask' (without the quotes) at the"
"\nmain prompt. You will then be asked to enter your question,"
"\nafter which you will receive the answer from the ball."
"\n\n Created by The Supreme Dark Overlo-- Joseph.")
elif choice == "quit":
break
else:
print "Error -- Try again\n"
raw_input()
--------------------------------------------------------------------------------------------------
-->Slayer<-- (Desk) idles.
Thursday, September 10, 2009
Subscribe to:
Posts (Atom)
