From aea9f3cbeb52003141a8f1ca6bbff32f2f4e399e Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 6 Sep 2010 21:52:09 -0600 Subject: [PATCH] Start at scoreboard generation --- src/scoreboard | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 src/scoreboard diff --git a/src/scoreboard b/src/scoreboard new file mode 100755 index 0000000..adb6355 --- /dev/null +++ b/src/scoreboard @@ -0,0 +1,38 @@ +#! /usr/bin/awk -f + +function output() { + for (c in points_by_cat) { + for (t in teams) { + printf("%d %s %f\n", + (lasttime - start) / 600, + t, + points_by_cat_team[c, t] / points_by_cat[c]); + } + } +} + +{ + time = $1 + team = $2 + cat = $3 + points = int($4) + + if (! start) { + start = time + } + + # Every 10 minutes + if (time > (outtime + 600)) { + outtime = time + output() + } + lasttime = time + + teams[team] = team + points_by_cat[cat] += points + points_by_cat_team[cat, team] += points +} + +END { + output() +}