Allow to parse the result of an unaccomplished game.
This commit is contained in:
parent
2b57870138
commit
8a85193ce3
@ -27,13 +27,13 @@ function parse_tour_info {
|
||||
local tour_info=$(cat "${REPO_DIR}/${TOURNAMENT}/tours/${tour}/tour_info"; echo)
|
||||
|
||||
local date_re="[0-9?]{2}\.[0-9?]{2}\.[0-9?]{4}"
|
||||
local res_re="(1-0|½-½|0-1)"
|
||||
local res_re="(1|½|0|\+|-)"
|
||||
while read line; do
|
||||
if [[ $line =~ ^($date_re)\ +([^\ ]+)\ +-\ +([^\ ]+)(\ +$res_re)? ]]; then
|
||||
if [[ $line =~ ^($date_re)\ +([^\ ]+)\ +-\ +([^\ ]+)(\ +$res_re-$res_re)? ]]; then
|
||||
local date=${BASH_REMATCH[1]}
|
||||
local white=${BASH_REMATCH[2]}
|
||||
local black=${BASH_REMATCH[3]}
|
||||
local result=${BASH_REMATCH[5]}
|
||||
local result=${BASH_REMATCH[5]}-${BASH_REMATCH[6]}
|
||||
local round=$(echo "($tour - 1)/($ply_count - 1) + 1" | bc)
|
||||
parse_to_ini
|
||||
((game_counter += 1))
|
||||
@ -47,7 +47,7 @@ function parse_to_ini {
|
||||
[[ ! $date =~ \? ]] && echo "date = $date"
|
||||
echo "white = $white"
|
||||
echo "black = $black"
|
||||
[[ -n $result ]] && echo "result = \"$result\""
|
||||
[[ $result == "-" ]] || echo "result = \"$result\""
|
||||
echo
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user