# Small Basic: Magic 8 Ball Simulation

This program simulates a Magic 8 Ball!

1. Try it out! Just copy and paste the code into Small Basic.
2. See if you can figure out what it's doing with arrays!

ans[1] = "It is certain. Like really, really certain."

ans[2] = "It is decidedly so. By me. I decided."

ans[3] = "Without a doubt. Maybe one doubt."

ans[4] = "Yes, definitely. Isn't it obvious?"

ans[5] = "Very doubtful. The doubt is very full."

ans[6] = "Maybe. Depends on the horse race."

ans[7] = "No. Wait. Yes. Wait. No. Yes, it's No."

ans[8] = "Let me consult my Magic 8 Ball... Yes."

ans[9] = "Perhaps. Per the haps. The happenings. Per them."

ans[10] = "You're asking an 8 Ball? What are you, crazy? The answer is Yes."

ans[11] = "Let me consult my Magic 8 Ball... No."

ans[12] = "Let me consult my Magic 8 Ball... Maybe. I hate that thing."

ans[15] = "Stop shaking me! That's totally disrespectful."

ans[16] = "If I say Yes will you stop shaking me? Yes."

ans[18] = "Indecisively so."

ans[19] = "Outlook not so good. Restart Outlook."

ans[20] = "Try again. It's funny when you shake things."

ans[21] = "It is certain. As certain as a curtain!"

ans[22] = "More or less. More than less."

ans[23] = "More or less. Considerably less than more of more than less."

ans[24] = "Most indubitably!"

While ("True")

TextWindow.WriteLine("Ask me a yes-no question. Do it!")

num = Math.GetRandomNumber(24)

TextWindow.WriteLine(ans[num])

TextWindow.WriteLine("")

EndWhile

Can you figure out what it's doing with arrays?

Have a Small and Basic day!

- Ninja Ed

Tags

1. A.Zaied says:

Thanks !

2. A.Zaied says:

Great article !

3. Here's another one:

4. Thanks Ammar!

5. Computers Today (part 1 of 6)

blogs.msdn.com/…/computers-today.aspx

…..

CS SPOTLIGHT: Girls in computer programming… why it matters!!!

blogs.msdn.com/…/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx

Computational Thinking – Videos & Papers by Jeannette Wing

blogs.msdn.com/…/computational-thinking-videos-amp-papers-by-jeannette-wing.aspx