Commit ace0a937 authored by user472393's avatar user472393
Browse files

first pass. still needs work to clean up the print outs and comment saving and such

parent cedce814
tetro48
bob
20
11
.----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .-----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------.
......
......@@ -507,16 +507,25 @@ racer () {
tv_updater
sleep 1
if [[ "$g1loser" != "$loser" ]]; then
for entry in "${!modes[@]}"; do
printer "decide the victor" ">>> @$p1 (${elo_db[$p1]%.*}) vs. @$p2 (${elo_db[$p2]%.*}) in $ask ${modes[entry]}" "$p1 !won <<or>> $p1 !lost"
$tv_titler -m "${modes[entry]}"
modes[entry]=">>>${modes[entry]}"
tv_updater
modes[entry]="${modes[entry]##*>}"
sleep 2
result_check
done
# cannot repick a mode unless you have lost it
if [[ "${mode_record[0]}" != "${mode_record[1]}" ]]; then
unset -v "${modes[${mode_record[0]}]}"
fi
printer "<<< then the choice is yours @$loser (${elo_db[$loser]%.*}) >>> $(for i in "${modes[@]}"; do printf '%s\t' "$i"; done)"
mode_select "$loser"
tv_updater
sleep 1
# for entry in "${!modes[@]}"; do
### printer "decide the victor" ">>> @$p1 (${elo_db[$p1]%.*}) vs. @$p2 (${elo_db[$p2]%.*}) in $ask ${modes[entry]}" "$p1 !won <<or>> $p1 !lost"
### $tv_titler -m "${modes[entry]}"
### modes[entry]=">>>${modes[entry]}"
### tv_updater
### modes[entry]="${modes[entry]##*>}"
### sleep 2
### result_check
### done
### sleep 1
fi
}
##########
......@@ -552,6 +561,7 @@ mode_select () {
modes[entry]=">>>${modes[entry]}"
tv_updater
modes[entry]="${modes[entry]##*>}"
mode_record+=("${!modes[entry]}")
sleep 2
result_check
break 2
......@@ -570,6 +580,7 @@ mode_select () {
&& (( ${#modes[@]} <= 3 )); then
printer ">>> @$p1 (${elo_db[$p1]%.*}) vs. @$p2 (${elo_db[$p2]%.*}) in $ask ${modes[entry]}" "$p1 !won <<or>> $p1 !lost"
$tv_titler -m "${modes[entry]}"
mode_record+=("${!modes[entry]}")
sleep 2
result_check
break 2
......@@ -584,23 +595,19 @@ result_check () {
while inotifywait -qq -e modify "$channel"; do
if tail -n 1 "$channel" | grep -i "$p1" | grep '!won'; then
elo_case1
modes[entry]+=" (+$p1)"
results[entry]="${modes[entry]}"
results[entry]="${modes[entry]} (+$p1)"
comments[entry]=$(tail -n 1 "$channel")
comments[entry]=${comments[entry],,}
comments[entry]=${comments[entry]#*!won}
unset -v modes["$entry"]
loser="$p2"
sleep 1
return 1
elif tail -n 1 "$channel" | grep -i "$p1" | grep '!lost'; then
elo_case2
modes[entry]+=" (+$p2)"
results[entry]="${modes[entry]}"
results[entry]="${modes[entry]} (+$p2)"
comments[entry]=$(tail -n 1 "$channel")
comments[entry]=${comments[entry],,}
comments[entry]=${comments[entry]#*!lost}
unset -v modes["$entry"]
loser="$p1"
sleep 1
return 1
......@@ -610,23 +617,19 @@ result_check () {
while read -r result ; do
if [[ "$result" =~ $p1 && "$result" =~ !won ]]; then
elo_case1
modes[entry]+=" (+$p1)"
results[entry]="${modes[entry]}"
results[entry]="${modes[entry]} (+$p1)"
comments[entry]=$result
comments[entry]=${comments[entry],,}
comments[entry]=${comments[entry]#*!won}
unset -v modes["$entry"]
loser="$p2"
sleep 1
return 1
elif [[ "$result" =~ $p1 && "$result" =~ !lost ]]; then
elo_case2
modes[entry]+=" (+$p2)"
results[entry]="${modes[entry]}"
results[entry]="${modes[entry]} (+$p2)"
comments[entry]=$result
comments[entry]=${comments[entry],,}
comments[entry]=${comments[entry]#*!lost}
unset -v modes["$entry"]
loser="$p1"
sleep 1
return 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment