summaryrefslogtreecommitdiff
path: root/src/layout_parse.pl
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2016-06-01 18:58:58 -0700
committerScott Gasch <[email protected]>2016-06-01 18:58:58 -0700
commit3fd43cd5fcb22bb65bf2a92a25d95d801b11c9e0 (patch)
tree9b6443235d16ba17f094a1a1c7ae53d2bcb9267b /src/layout_parse.pl
Initial checkin for typhoon chess engine.
Diffstat (limited to 'src/layout_parse.pl')
-rwxr-xr-xsrc/layout_parse.pl43
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);