Tuesday, 26 February 2013

Magic 8 ball

Do you remember the magic 8 ball?
If not you can read this http://en.wikipedia.org/wiki/Magic_8-Ball about this ball that help yo to take decisions.
Well, the following script is a very simple example of recreate that:

Rebol []
random/seed now
sentences: [
    "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"
    "Reply hazy, try again"
    "Ask again later"
    "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"
    ]
   
view   layout [
    h1 "Ask the magic ball"
   
    button "ASK" [  
    a: pick   sentences (random 20)
    answer/text: a
    answer/color: random 255.255.255
    show answer
    ]
    answer: vtext "________________________"
    ]

No comments:

Post a Comment