diff options
Diffstat (limited to 'src/layout_parse.pl')
| -rwxr-xr-x | src/layout_parse.pl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/layout_parse.pl b/src/layout_parse.pl new file mode 100755 index 0000000..f0d055a --- /dev/null +++ b/src/layout_parse.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +opendir(DIR, ".") || die; +@files = readdir(DIR); +closedir(DIR); + +$max = 0; +$maxpos = -1; +$sum = 0; +$min = 99999999; +$minpos = -1; +$count = 0; + +for $file(@files) +{ + if ($file =~ /(\d+)typhoon\.log/) + { + $num = $1; + open(FILE, $file); + while(<FILE>) + { + if (/\((\d+) nps\)\./) + { + $count++; + $speed = $1; + $sum += $speed; + if ($speed > $max) + { + $maxpos = $num; + $max = $speed; + } + if ($speed < $min) + { + $minpos = $num; + $min = $speed; + } + } + } + close(FILE); + } +} + +printf "max $max at $maxpos, min $min at $minpos, avg %f\n", ($sum/$count); |
