Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
8
Task/Magic-8-ball/EasyLang/magic-8-ball.easy
Normal file
8
Task/Magic-8-ball/EasyLang/magic-8-ball.easy
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
answers$[] = [ "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" "Signs point to yes" "Yes" "Reply hazy, try again" "Ask again later" "Better not tell you now" "Cannot predict now" "Concentrate and ask again" "Don't bet on it" "My reply is no" "My sources say no" "Outlook not so good" "Very doubtful" ]
|
||||
print "q to quit."
|
||||
repeat
|
||||
print "What would you like to know? "
|
||||
q$ = input
|
||||
until q$ = "q"
|
||||
print answers$[randint len answers$[]]
|
||||
.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
RESPONSES=("It is certain" "It is decidedly so" "Without a doubt"
|
||||
declare -ra RESPONSES=("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" "Signs point to yes" "Yes"
|
||||
"Reply hazy try again" "Ask again later"
|
||||
|
|
@ -12,13 +12,8 @@ RESPONSES=("It is certain" "It is decidedly so" "Without a doubt"
|
|||
printf "Welcome to 8 ball! Enter your questions using the prompt below to
|
||||
find the answers you seek. Type 'quit' to exit.\n\n"
|
||||
|
||||
while true; do
|
||||
read -p 'Enter Question: ' question
|
||||
if [ "$question" == "quit" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
response_index=$(($RANDOM % 20))
|
||||
|
||||
printf "Response: ${RESPONSES[response_index]}\n\n"
|
||||
until
|
||||
read -p 'Enter Question: '
|
||||
[[ "$REPLY" == quit ]]
|
||||
do printf "Response: %s\n\n" "${RESPONSES[RANDOM % ${#RESPONSES[@]}]}"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue