File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
+ dir=~ /.trg
3
+
4
+ [ -f " $dir " ] && rm -i " $dir "
5
+ [ -d " $dir " ] || mkdir " $dir "
6
+
2
7
score=0
3
- word=" $1 "
8
+ word=" $6 "
4
9
[ " $word " ] || read word
5
10
while say " $word " -v Alex; do
6
- if [ " $word " = death -o " $word " = disease -o " $word " = evil -o " $word " = depression -o " $word " = sorrow -o " $word " = murder ]; then
7
- read hiname hiscore 2> /dev/null < ~ /.trg || hiscore=0
11
+ if [ " $word " = " $1 " -o " $word " = " $2 " -o " $word " = " $3 " -o " $word " = " $4 " -o " $word " = " $5 " ]; then
12
+ words=$( printf " ${1} \n${2} \n${3} \n${4} \n${5} \n" | sort)
13
+ for word in $words ; do fname=" ${fname} ${word} " ; done
14
+ scorefile=" ${dir} /${fname} .trg"
15
+ read hiname hiscore 2> /dev/null < " $scorefile " || hiscore=0
8
16
if [ $score -gt $hiscore ]; then
9
17
hiscore=$score
10
18
sleep 0.5
@@ -15,14 +23,14 @@ while say "$word" -v Alex; do
15
23
read name
16
24
hiname=$name
17
25
echo
18
- echo " $name " $score > ~ /.trg
26
+ echo " $name " $score > " $scorefile "
19
27
fi
20
28
echo Your Score: $score
21
29
echo High" " Name: " $hiname "
22
30
echo High Score: $hiscore
23
31
exit
24
32
fi
25
- word=$( curl " https://api.datamuse.com/words?topics=evil+disease+death+depression+sorrow &rel_trg=${word} " 2> /dev/null | jq -r .[$(( RANDOM % 3 )) ].word)
33
+ word=$( curl " https://api.datamuse.com/words?topics=${1} + ${2} + ${3} + ${4} + ${5} &rel_trg=${word} " 2> /dev/null | jq -r .[$(( RANDOM % 3 )) ].word)
26
34
if [ " $word " = null ]; then
27
35
exit
28
36
fi
You can’t perform that action at this time.
0 commit comments