Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Magic-8-ball/Sather/magic-8-ball-1.sa
Normal file
20
Task/Magic-8-ball/Sather/magic-8-ball-1.sa
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
class MAIN is
|
||||
const answers: ARRAY{STR} :=
|
||||
|
|
||||
"It is certain.", "It is decidedly so.",
|
||||
"Without a doubt.", "Yes - definitely.", "You may rely on it.",
|
||||
"As I see it, yes.", "Most likely.", "Outlook good.",
|
||||
"Yes.", "Signs point to yes.", "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."
|
||||
|;
|
||||
main is
|
||||
RND::seed := #TIMES.wall_time;
|
||||
loop
|
||||
#OUT+"Your question: "; #OUT.flush;
|
||||
question ::= #IN.get_str;
|
||||
#OUT+answers[RND::int(0, answers.size-1)] + "\n";
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
29
Task/Magic-8-ball/Sather/magic-8-ball-2.sa
Normal file
29
Task/Magic-8-ball/Sather/magic-8-ball-2.sa
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import scala.util.Random
|
||||
|
||||
object Magic8Ball extends App {
|
||||
val shake: () => String = {
|
||||
val answers = List(
|
||||
"It is certain.", "It is decidedly so.", "Without a doubt.",
|
||||
"Yes – definitely.", "You may rely on it.", "As I see it, yes.",
|
||||
"Most likely.", "Outlook good.", "Yes.", "Signs point to yes.",
|
||||
"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."
|
||||
)
|
||||
val r = new Random
|
||||
() => answers(r.nextInt(answers.length))
|
||||
}
|
||||
|
||||
println("Ask the Magic 8-Ball your questions. ('q' or 'quit' to quit)\n")
|
||||
|
||||
while (true) {
|
||||
io.StdIn.readLine("Question: ").toLowerCase match {
|
||||
case "q" | "quit" =>
|
||||
println("Goodbye.")
|
||||
sys.exit()
|
||||
case _ =>
|
||||
println(s"Response: ${shake()}\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Task/Magic-8-ball/Sather/magic-8-ball-3.sa
Normal file
34
Task/Magic-8-ball/Sather/magic-8-ball-3.sa
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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
|
||||
}
|
||||
46
Task/Magic-8-ball/Sather/magic-8-ball-4.sa
Normal file
46
Task/Magic-8-ball/Sather/magic-8-ball-4.sa
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
10 PRINT "Concentrate hard on your question, then tell me your favorite number."
|
||||
20 INPUT N
|
||||
30 REM in lieu of a random number generator
|
||||
40 IF N<0 THEN LET N=-N
|
||||
50 IF N<20 THEN GOTO 1000+N*10
|
||||
60 LET N=N-20
|
||||
70 GOTO 50
|
||||
1000 PRINT "It is certain."
|
||||
1005 END
|
||||
1010 PRINT "It is decidedly so."
|
||||
1015 END
|
||||
1020 PRINT "Without a doubt."
|
||||
1025 END
|
||||
1030 PRINT "Yes - definitely."
|
||||
1035 END
|
||||
1040 PRINT "You may rely on it."
|
||||
1045 END
|
||||
1050 PRINT "As I see it, yes."
|
||||
1055 END
|
||||
1060 PRINT "Most likely."
|
||||
1065 END
|
||||
1070 PRINT "Outlook good."
|
||||
1075 END
|
||||
1080 PRINT "Yes."
|
||||
1085 END
|
||||
1090 PRINT "Signs point to yes."
|
||||
1095 END
|
||||
1100 PRINT "Reply hazy, try again."
|
||||
1105 END
|
||||
1110 PRINT "Ask again later."
|
||||
1115 END
|
||||
1120 PRINT "Better not tell you now."
|
||||
1125 END
|
||||
1130 PRINT "Cannot predict now."
|
||||
1135 END
|
||||
1140 PRINT "Concentrate and ask again."
|
||||
1145 END
|
||||
1150 PRINT "Don't count on it."
|
||||
1155 END
|
||||
1160 PRINT "My reply is no."
|
||||
1165 END
|
||||
1170 PRINT "My sources say no."
|
||||
1175 END
|
||||
1180 PRINT "Outlook not so good."
|
||||
1185 END
|
||||
1190 PRINT "Very doubtful."
|
||||
Loading…
Add table
Add a link
Reference in a new issue