Added cpu vs cpu mode, enter c as te only arg to get it. Hopefully cut down on the cpu strain when generating power and direction bar tones.

This commit is contained in:
Storm Dragon 2014-05-04 18:29:16 -04:00
parent 64d814f007
commit 7a59f33fc5

View File

@ -80,7 +80,7 @@ elif [ $x -ge 50 ] ; then
local stepper="--" local stepper="--"
fi fi
let x$stepper let x$stepper
play -nq synth 0.03 tri $(($x *50))& play --no-dither --single-threaded -nq synth 0.03 tri $(($x *50))&
read -st 0.03 -n 1 continue read -st 0.03 -n 1 continue
done done
if [[ $__strength_bar_result ]] ; then if [[ $__strength_bar_result ]] ; then
@ -108,7 +108,7 @@ local rStepper="--"
fi fi
let lChan$lStepper let lChan$lStepper
let rChan$rStepper let rChan$rStepper
play -nq synth 0.05 tri 300 remix v0.$lChan v0.$rChan& play --no-dither --single-threaded -nq synth 0.05 tri 300 remix v0.$lChan v0.$rChan&
read -st 0.05 -n 1 continue read -st 0.05 -n 1 continue
done done
if [ $lChan -ge 5 ] ; then if [ $lChan -ge 5 ] ; then
@ -127,13 +127,19 @@ fi
} }
check_dependancies rolldice check_dependancies rolldice
if [ "$1" != "c" ] ; then
read -n 1 -p "Would you like instructions? " answer read -n 1 -p "Would you like instructions? " answer
echo echo
if [ "${answer^}" == "Y" ] ; then if [ "${answer^}" == "Y" ] ; then
show_instructions show_instructions
fi fi
fi
echo "Welcome to horseshoes." echo "Welcome to horseshoes."
if [ "$1" != "c" ] ; then
read -p "Player 1, please enter your name: " player[1] read -p "Player 1, please enter your name: " player[1]
else
player[1]="$(get_cpu_name)"
fi
if [[ "$1" =~ 2 ]] ; then if [[ "$1" =~ 2 ]] ; then
read -p "Player 2, please enter your name: " player[2] read -p "Player 2, please enter your name: " player[2]
vsCpu="false" vsCpu="false"
@ -148,8 +154,8 @@ echo "${player[1]} verses ${player[2]}. Good luck!"
while [ ${score[1]} -lt 15 -a ${score[2]} -lt 15 ] ; do while [ ${score[1]} -lt 15 -a ${score[2]} -lt 15 ] ; do
msg="" msg=""
echo "${player[$playerCounter]} is up to throw. Press any key to continue." echo "${player[$playerCounter]} is up to throw. Press any key to continue."
if [ $playerCounter -eq 2 -a "$vsCpu" == "true" ] ; then if [ $playerCounter -eq 2 -a "$vsCpu" == "true" -o "$1" == "c" ] ; then
sleep 0.7 sleep 1.5
echo echo
distance=$(rolldice 2d10+30) distance=$(rolldice 2d10+30)
direction=$(rolldice 2d4) direction=$(rolldice 2d4)
@ -187,7 +193,7 @@ hitSound="miss"
fi fi
play_throw $distance $hitSound play_throw $distance $hitSound
echo "$msg" echo "$msg"
echo "${player[$playerCounter]}'s score is ${score[$playerCounter]}." echo "score: ${player[1]} ${score[1]} -- ${player[2]} ${score[2]}"
echo echo
if [ $playerCounter -eq 1 ] ; then if [ $playerCounter -eq 1 ] ; then
playerCounter=2 playerCounter=2