RosettaCodeData/Task/Magic-8-ball/Sather/magic-8-ball-3.sa
2023-07-01 13:44:08 -04:00

34 lines
770 B
Text

namespace path {::tcl::mathop ::tcl::mathfunc}
set answers {
"As I see it, yes"
"Ask again later"
"Better not tell you now"
"Cannot predict now"
"Concentrate and ask again"
"Don't bet on it"
"It is certain"
"It is decidedly so"
"Most likely"
"My reply is no"
"My sources say maybe"
"My sources say no"
"Outlook good"
"Outlook not so good"
"Reply hazy, try again"
"Signs point to yes"
"Very doubtful"
"Without a doubt"
"Yes"
"Yes, definitely"
"Yes, probably not"
"You may rely on it"
"Your question has already been answered"
}
puts -nonewline "Question: "; flush stdout
while {[gets stdin line] > 0} {
set answer [lindex $answers [int [* [rand] [llength $answers]]]]
puts "⑧ says “$answer”"
puts -nonewline "Question: "; flush stdout
}