Just select one winner

This commit is contained in:
Neale Pickett 2011-02-12 20:31:54 -07:00
parent af21d38986
commit b8229bcb8a
1 changed files with 7 additions and 1 deletions

View File

@ -12,12 +12,18 @@ BEGIN {
p = $4; p = $4;
} }
score[p] += 1; score[p] += 1;
if (score[p] > topscore) { if (score[p] == topscore) {
winners += 1;
} else if (score[p] > topscore) {
winners = 1;
topscore = score[p]; topscore = score[p];
} }
} }
END { END {
if (winners > 1) {
exit;
}
for (id in tanks) { for (id in tanks) {
if (score[id] == topscore) { if (score[id] == topscore) {
print tanks[id]; print tanks[id];