X-Git-Url: http://git.shiar.net/perl/schtarr.git/blobdiff_plain/80e893e4edd9fe3e2f3c7eae0e49d193f19f2a16..bce4a260fd2d568d21e81bf71238e2da9b5fdb38:/screp diff --git a/screp b/screp index 10a2554..0b35ac0 100755 --- a/screp +++ b/screp @@ -10,6 +10,8 @@ GetOptions( "verbose|v!" => \$SHOWWARN, ); +use constant { APM_FIRSTFRAME => 80 / .042 }; + { package Data::StarCraft::Replay; @@ -475,8 +477,6 @@ if ($SHOWWARN) { } } -printf "duration: %s\n", showtime($map->[-1][0]); - my %cmdmacro = map {$_ => 1} ( (map {$_, "cancel $_"} qw/train build hatch research upgrade arm/, @@ -488,7 +488,7 @@ my %cmdmacro = map {$_ => 1} ( my %stats; # player => count for (@$map) { $stats{$_->[1]}{actions}++; - $stats{$_->[1]}{gameactions}++ if $_->[0] > 80 / .042; + $stats{$_->[1]}{gameactions}++ if $_->[0] >= APM_FIRSTFRAME; $stats{$_->[1]}{last} = $_->[0] if $_->[2] eq "part"; $stats{$_->[1]}{$cmdmacro{$_->[2]} ? "macro" : "micro"}++; $stats{$_->[1]}{count}{$_->[2]}++; @@ -498,13 +498,12 @@ for my $player (sort keys %stats) { my $row = $stats{$player}; $row->{last} ||= $map->[-1][0]; # printf("%d:%6d actions (%3d micro,%4d macro);%4d APM\n", - printf("%d:%6d actions;%4d APM\n", - $player, - $row->{actions}, + printf("%d:%6d actions in%7d frames (%s) = %d APM\n", + $player, $row->{actions}, $row->{last}, + showtime($row->{last}), # $row->{micro} / $row->{last} * 60 / .042 * 1.05, # $row->{macro} / $row->{last} * 60 / .042 * 1.05, - $row->{gameactions} / $row->{last} * 60 / .042 * 1.042, - # $row->{gameactions} / $map->[-1][0] * 60 / .042, + $row->{gameactions} / ($row->{last} - APM_FIRSTFRAME) * 60 / .042, ); if (0) {