Füge fehlende Bild-Dateien hinzu.
[diplomarbeit.git] / images / markov-comparators-to-percent.px
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 my $iterations = 0;
7 my $comparators = 0;
8 my %data = ();
9
10 while (<>)
11 {
12         chomp;
13         my ($x, $y) = split;
14
15         $iterations += $y;
16         $comparators += ($x * $y);
17         $data{$x} = $y;
18 }
19
20 print "# Iterations: $iterations\n";
21 printf "# Average: %.6f\n", $comparators / $iterations;
22 for (sort { $a <=> $b } (keys %data))
23 {
24         printf "%-4i %.6f\n", $_, 100.0 * $data{$_} / $iterations;
25 }