From 3fd43cd5fcb22bb65bf2a92a25d95d801b11c9e0 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Wed, 1 Jun 2016 18:58:58 -0700 Subject: Initial checkin for typhoon chess engine. --- src/genetic/score_histogram.pl | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 src/genetic/score_histogram.pl (limited to 'src/genetic/score_histogram.pl') diff --git a/src/genetic/score_histogram.pl b/src/genetic/score_histogram.pl new file mode 100755 index 0000000..facc71a --- /dev/null +++ b/src/genetic/score_histogram.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +$gen = $ARGV[0]; +opendir(DIR, "."); +@files = readdir(DIR); +closedir(DIR); + +$min_score = 999999999; $max_score = 0; +$total = 0; +$best = ""; +for $file(@files) { + if ($file =~ m/gen(\d+)_\d+\.log/) { + $score = 0; + next if $1 != $gen; + open(FILE, $file) || die $!; + $total++; + while() { + chop; + if (m/ correct solutions\s+\:\s+(\d+)/) { + $score = $1; + last; + } + } + $score = int($score); + $scores[$score] += 1; + $names{$score} .= "$file "; + if ($score > $max_score) { + $max_score = $score; + $best = $file; + } + $min_score = $score if ($score < $min_score); + close(FILE); + } +} + +for ($x = $min_score; $x <= $max_score; $x++) { + next if $scores[$x] == 0; + printf "%4u : ", $x; + print "*" x int($scores[$x] / $total * 60); + print " ($scores[$x], $names{$x})\n"; +} +print "Best was $best\n"; +system "tail -22 $best"; -- cgit v1.3