| 順位 | 点 | 差 | 国 | 
|---|---|---|---|
| 1 | 13 | 10 | 日本 | 
| 2 | 7 | -6 | ヨルダン | 
| 3 | 6 | 0 | オーストラリア | 
| 4 | 6 | -3 | オマーン | 
| 5 | 5 | -1 | イラク | 
2013.6.4
日本 vs オーストラリア
オマーン vs イラク
2013.6.11
オーストラリア vs ヨルダン
イラク vs 日本
2013.6.18
オーストラリア vs イラク
ヨルダン vs オマーン
#!/usr/bin/perl
use strict;
use warnings;
use Storable;
# 2013/3/26の試合終了後の勝ち点
my $c_ref = {
          '日本' => '13',
          'ヨルダン' => '7',
          'オーストラリア' => '6',
          'オマーン' => '6',
          'イラク' => '5'
};
# 残りの試合
my @ms = (
    ['2013.06.04', "日本", "オーストラリア"],
    ['2013.06.04', "オマーン", "イラク"],
    ['2013.06.11', "オーストラリア", "ヨルダン"],
    ['2013.06.11', "イラク", "日本"],
    ['2013.06.18', "オーストラリア", "イラク"],
    ['2013.06.18', "ヨルダン", "オマーン"]
    );
my @results;
df_simu($c_ref, []);
foreach my $r (@results) {
    print join(", ", map {"$_($r->{c}{$_})"} sort {$r->{c}{$b} <=> $r->{c}{$a}} keys %{$r->{c}})."\n";
    for (my $i = 0; $i < @ms; $i++) {
        print " ".$ms[$i][0]." ";
        my $mr = $r->{h}[$i];
        if ($mr == 0) { # 0 Home Win, 1 Draw, 2 Away Win
            print "o $ms[$i][1] : x $ms[$i][2]\n";
        } elsif ($mr == 1) {
            print "- $ms[$i][1] : - $ms[$i][2]\n";
        } elsif ($mr == 2) {
            print "x $ms[$i][1] : o $ms[$i][2]\n";
        }
    }
    print "\n";
}
sub df_simu {
    my ($c_ref, $h_ref) = @_;
    my $nth = @$h_ref;
    if ($nth == @ms) {
        push @results, {c => $c_ref, h => $h_ref};
        return;
    }
    foreach my $mr (0, 1, 2) { # 0 Home Win, 1 Draw, 2 Away Win
        my $t_ref = Storable::dclone($c_ref);
        if ($mr == 0) {
            $t_ref->{$ms[$nth][1]} += 3;
        } elsif ($mr == 1) {
            $t_ref->{$ms[$nth][1]} += 1;
            $t_ref->{$ms[$nth][2]} += 1;
        } elsif ($mr == 2) {
            $t_ref->{$ms[$nth][2]} += 3;
        }
        df_simu($t_ref, [@$h_ref, $mr]);
    }
}
% ./fifa.pl 日本(16), オーストラリア(12), ヨルダン(10), オマーン(9), イラク(8) 2013.06.04 o 日本 : x オーストラリア 2013.06.04 o オマーン : x イラク 2013.06.11 o オーストラリア : x ヨルダン 2013.06.11 o イラク : x 日本 2013.06.18 o オーストラリア : x イラク 2013.06.18 o ヨルダン : x オマーン 日本(16), オーストラリア(12), オマーン(10), ヨルダン(8), イラク(8) 2013.06.04 o 日本 : x オーストラリア 2013.06.04 o オマーン : x イラク 2013.06.11 o オーストラリア : x ヨルダン 2013.06.11 o イラク : x 日本 2013.06.18 o オーストラリア : x イラク 2013.06.18 - ヨルダン : - オマーン 日本(16), オーストラリア(12), オマーン(12), イラク(8), ヨルダン(7) 2013.06.04 o 日本 : x オーストラリア 2013.06.04 o オマーン : x イラク 2013.06.11 o オーストラリア : x ヨルダン 2013.06.11 o イラク : x 日本 2013.06.18 o オーストラリア : x イラク 2013.06.18 x ヨルダン : o オマーン
イラク(14), ヨルダン(13), 日本(13), オーストラリア(9), オマーン(6) 2013.06.04 x 日本 : o オーストラリア 2013.06.04 x オマーン : o イラク 2013.06.11 x オーストラリア : o ヨルダン 2013.06.11 o イラク : x 日本 2013.06.18 x オーストラリア : o イラク 2013.06.18 o ヨルダン : x オマーン