-POSIX::setlocale(&POSIX::LC_ALL, 'nb_NO.UTF-8');
-printf <<"EOF", $match_stddev;
+if (defined($match_player) && defined($match_position)) {
+ my $tmpnam = write_parms_to_file($aux_parms, $match_stddev, \%ratings, $cov);
+
+ --$match_player;
+ --$match_position;
+
+ my @scenario = ();
+ open MCCALC, "$config::base_dir/mcwordfeud $trials $match_player $match_position < $tmpnam |"
+ or die "mccalc: $!";
+ while (<MCCALC>) {
+ /(\d+) (\d+) (-?\d+)/ or next;
+ chomp;
+ push @scenario, [ $1, $2, $3 ];
+ }
+ close MCCALC;
+ #unlink $tmpnam;
+
+ if (scalar @scenario == 0) {
+ # FIXME: distinguish between "all played" and "none found"
+ print " <p>Fant ingen måte dette kunne skje på.</p>\n";
+ } else {
+ print " <ul>\n";
+ for my $m (@scenario) {
+ printf " <li>%s – %s: %+d</li>\n", $players{$m->[0]}, $players{$m->[1]}, $m->[2];
+ }
+ print " </ul>\n";
+ }
+} else {
+ POSIX::setlocale(&POSIX::LC_ALL, 'nb_NO.UTF-8');
+ printf <<"EOF", $match_stddev;