From 356311c21796857af2c46a11fa65c00c714972ae Mon Sep 17 00:00:00 2001 From: vonavi Date: Sun, 20 Oct 2013 14:08:46 +0300 Subject: [PATCH 1/3] 'schedule': small improvements. --- schedule | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/schedule b/schedule index 3908e8c..20a5b9c 100755 --- a/schedule +++ b/schedule @@ -49,16 +49,16 @@ shift # Generate the sequence of tours to search in if [[ -z "$@" ]]; then - tours=$(seq -f "%02g" 1 99) + seq=$(seq -f "%02g" 1 99) else # Change tour numbers: '1' -> '01', '2' -> '02', and so on - tours=$(for tour in "$@"; do printf "%02g " $tour; done) + seq=$(for num in "$@"; do printf "%02g " "$num"; done) fi -for tour in $tours; do +for num in $seq; do # Store 'tour_info' in an array of lines - url=https://raw.github.com/$REPO/master/$TOURNEY/tour_$tour/tour_info + url="https://raw.github.com/${REPO}/master/${TOURNEY}/tour_${num}/tour_info" lines=() while read line; do lines+=("$line") @@ -79,7 +79,7 @@ for tour in $tours; do # In addition, if the player was passed as an # argument, check if this is his game or not - elif [[ -n $(grep -o "[^ ]*${name}[^ ]*" <<< "$line") ]]; then + elif [[ -n $(grep -o "$name" <<< "$line") ]]; then unskip="yes" # Complete player's name player=$(grep -o "[^ ]*${name}[^ ]*" <<< "$line") From 331dd6692f16198938c28ea635898fc7809f0370 Mon Sep 17 00:00:00 2001 From: vonavi Date: Sun, 20 Oct 2013 14:09:05 +0300 Subject: [PATCH 2/3] Update game results. --- autumn2013/results.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/autumn2013/results.yml b/autumn2013/results.yml index 5a836b5..37f5c0c 100644 --- a/autumn2013/results.yml +++ b/autumn2013/results.yml @@ -218,6 +218,11 @@ black: Genuine result: '0:1' + - date: 19.10.2013 + white: Nokman + black: Magian + result: '0:1' + - date: 23.09.2013 white: shell-script black: redgremlin @@ -235,6 +240,11 @@ black: shell-script result: '1:0' + - date: 19.10.2013 + white: Genuine + black: Nokman + result: '1:0' + - date: 27.09.2013 white: LongLiveUbuntu black: Nedis @@ -381,6 +391,11 @@ black: DoctorSinus result: '1:0' + - date: 19.10.2013 + white: Nedis + black: farzeet + result: '1:0' + - date: 05.10.2013 white: Nokman black: uroboros @@ -403,6 +418,11 @@ black: Magian result: '0:1' + - date: 12.10.2013 + white: raven_cler + black: redgremlin + result: '0:1' + - date: 04.10.2013 white: uroboros black: shell-script @@ -521,3 +541,8 @@ black: LongLiveUbuntu result: '0:1' + - date: 19.10.2013 + white: aptyp + black: Nokman + result: '1:0' + From 08de94267900b4adda21ec17a04b63f9d4cc8238 Mon Sep 17 00:00:00 2001 From: vonavi Date: Sun, 20 Oct 2013 14:30:02 +0300 Subject: [PATCH 3/3] 'schedule': small improvements. --- schedule | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/schedule b/schedule index 20a5b9c..8fb8a9f 100755 --- a/schedule +++ b/schedule @@ -52,13 +52,17 @@ if [[ -z "$@" ]]; then seq=$(seq -f "%02g" 1 99) else # Change tour numbers: '1' -> '01', '2' -> '02', and so on - seq=$(for num in "$@"; do printf "%02g " "$num"; done) + seq=$(for i in "$@"; do printf "%02g " "$i"; done) fi -for num in $seq; do +for i in $seq; do - # Store 'tour_info' in an array of lines - url="https://raw.github.com/${REPO}/master/${TOURNEY}/tour_${num}/tour_info" + url="https://raw.github.com/${REPO}/master/${TOURNEY}/tour_${i}/tour_info" + + # Store 'tour_info' in an array of lines. + # *NOTE* The incorporation of newline at the end of 'tour_info' + # (--write-out '\n') is important and allows one to read the last + # line without trailing '\n' lines=() while read line; do lines+=("$line") @@ -69,8 +73,8 @@ for num in $seq; do # Decide to skip the tour or not unskip=""; player="" - for ((i=5; i<${#lines[@]}; ++i)); do - line="${lines[$i]}" + for ((j=5; j<${#lines[@]}; ++j)); do + line="${lines[$j]}" # Don't skip if an unfinished game exists if [[ -z $(grep "$result" <<< "$line") ]]; then @@ -91,15 +95,15 @@ for num in $seq; do # The separator between tours echo -en "$yellow" - for i in {1..41}; do echo -n "-"; done + for j in {1..41}; do echo -n "-"; done echo -e "$restore" # Output the tour heading as is - for ((i=0; i<5; ++i)); do highlight "${lines[$i]}"; done + for ((j=0; j<5; ++j)); do highlight "${lines[$j]}"; done # Lines with game info - for ((i=5; i<${#lines[@]}; ++i)); do - line="${lines[$i]}" + for ((j=5; j<${#lines[@]}; ++j)); do + line="${lines[$j]}" # Output only unfinished games if [[ -z $(grep "$result" <<< "$line") ]]; then