Browse Source

use one streak function

typed_gg
user030276 3 months ago
parent
commit
79f96fd060
  1. 28
      awk_extract

28
awk_extract

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
# between start and finish flags, increment point values
# update point streak
/Match has begun/ {sf++}
/take it/ && (sf) && (!ff) { pv["1",$1]++; otreak($1) }
/take it/ && (sf) && (!ff) { pv["1",$1]++; streak($1,1) }
/rocket/ && (sf) && (!ff) { pv["2",$1]++; streak($1) }
/railed/ && (sf) && (!ff) { pv["3",$1]++; streak($1) }
/light/ && (sf) && (!ff) { pv["4",$1]++; streak($1) }
@ -82,22 +82,18 @@ printf "\n" @@ -82,22 +82,18 @@ printf "\n"
}
# consecutive scoring
function streak(p) {
# if player is most recent scorer
if (p==mrs) {
# increment counter, save max in pv array
function streak(p,o) {
# if own goal and most recent scorer
# save max in pv array and reset
if (o) {
if (p==mrs) {
(s[p]>pv["0",p]) && pv["0",p]=s[p]
s[p]=0; mrs=""
}
# else if most recent scorer increment and save
} else if (p==mrs) {
s[p]++
(s[p]>pv["0",p]) && pv["0",p]=s[p]
# else new streak and mrs
# else new streak and most recent scorer
} else { s[p]=0; mrs=p }
}
# own goals and consecutive scoring
function otreak(p) {
# if player is most recent scorer
if (p==mrs) {
# save max in pv array
(s[p]>pv["0",p]) && pv["0",p]=s[p]
# reset
s[p]=0; mrs=""
}
}

Loading…
Cancel
Save