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!
  3. Leave a comment if you have more silly 8-Ball answers, and I’ll add them in here!

 

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[13] = “About 50.01% Yes.”

ans[14] = “About 49.99% No.”

ans[15] = “Stop shaking me! That’s totally disrespectful.”

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

ans[17] = “Admittedly so. Admitted by someone. Not sure who.”

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!”

ans[25] = “Ask your mother.”

While (“True”)

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

ques = TextWindow.Read()

num = Math.GetRandomNumber(24)

TextWindow.WriteLine(ans[num])

TextWindow.WriteLine(“”)

EndWhile

        

   

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

Leave a comment if you have more silly 8-Ball answers, and I’ll add them in here!

 

Go to http://blogs.msdn.com/SmallBasic to download Small Basic for free and learn all about it!

 

Have a Small and Basic day!

   – Ninja Ed

Comments (5)

  1. A.Zaied says:

    Thanks !

  2. A.Zaied says:

    Great article !

  3. Here's another one:

    Ask your mother.

  4. 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

Skip to main content