#! /usr/bin/awk -f function esc(s) { gsub(/&/, "&", s); gsub(//, ">", s); return s; } BEGIN { print ""; print ""; print " "; print " Dirtbags Tanks"; print " "; print " "; print " "; print "

Dirtbags Tanks

"; print "

Resources

"; print " "; print "

Rankings

"; print "
    "; for (i = 1; i < ARGC; i += 1) { id = ARGV[i]; if (1 == getline < (id "/name")) { names[id] = esc($0); } else { names[id] = "Unnamed"; } getline < (id "/color"); if (/^#[0-9A-Fa-f]+$/) { color[id] = $0; } else { color[id] = "#c0c0c0"; } p = 0; while (1 == getline < (id "/points")) { p += $0; } scores[p] = p; points[id] = p; nscores } while (1) { # Find highest score maxscore = -1; for (p in scores) { if (int(p) > maxscore) { maxscore = int(p); } } if (maxscore == -1) { break; } delete scores[maxscore]; for (id in points) { if (points[id] == maxscore) { printf("
  1. # %s (%d wins)
  2. \n", color[id], names[id], points[id]); } } } print "
"; print "

Rounds

"; print " "; print " "; print ""; }