Created
October 28, 2013 18:32
-
-
Save mjdominus/7202104 to your computer and use it in GitHub Desktop.
Tabletop game probability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
for $p (1..6) {for $q (1..6) {for $r (1..6) { | |
my @dice = sort { $a <=> $b } $p, $q, $r; | |
$count{join "-", @dice}++; | |
}}} | |
for my $roll (sort keys %count) { | |
printf "%5s %3d %5.2f%%\n", | |
$roll, $count{$roll}, $count{$roll}*100/216; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1-2-3 6 2.78% | |
1-2-4 6 2.78% | |
1-2-5 6 2.78% | |
1-2-6 6 2.78% | |
1-3-4 6 2.78% | |
1-3-5 6 2.78% | |
1-3-6 6 2.78% | |
1-4-5 6 2.78% | |
1-4-6 6 2.78% | |
1-5-6 6 2.78% | |
2-3-4 6 2.78% | |
2-3-5 6 2.78% | |
2-3-6 6 2.78% | |
2-4-5 6 2.78% | |
2-4-6 6 2.78% | |
2-5-6 6 2.78% | |
3-4-5 6 2.78% | |
3-4-6 6 2.78% | |
3-5-6 6 2.78% | |
4-5-6 6 2.78% | |
1-1-2 3 1.39% | |
1-1-3 3 1.39% | |
1-1-4 3 1.39% | |
1-1-5 3 1.39% | |
1-1-6 3 1.39% | |
1-2-2 3 1.39% | |
1-3-3 3 1.39% | |
1-4-4 3 1.39% | |
1-5-5 3 1.39% | |
1-6-6 3 1.39% | |
2-2-3 3 1.39% | |
2-2-4 3 1.39% | |
2-2-5 3 1.39% | |
2-2-6 3 1.39% | |
2-3-3 3 1.39% | |
2-4-4 3 1.39% | |
2-5-5 3 1.39% | |
2-6-6 3 1.39% | |
3-3-4 3 1.39% | |
3-3-5 3 1.39% | |
3-3-6 3 1.39% | |
3-4-4 3 1.39% | |
3-5-5 3 1.39% | |
3-6-6 3 1.39% | |
4-4-5 3 1.39% | |
4-4-6 3 1.39% | |
4-5-5 3 1.39% | |
4-6-6 3 1.39% | |
5-5-6 3 1.39% | |
5-6-6 3 1.39% | |
1-1-1 1 0.46% | |
2-2-2 1 0.46% | |
3-3-3 1 0.46% | |
4-4-4 1 0.46% | |
5-5-5 1 0.46% | |
6-6-6 1 0.46% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1-1-1 1 0.46% | |
1-1-2 3 1.39% | |
1-1-3 3 1.39% | |
1-1-4 3 1.39% | |
1-1-5 3 1.39% | |
1-1-6 3 1.39% | |
1-2-2 3 1.39% | |
1-2-3 6 2.78% | |
1-2-4 6 2.78% | |
1-2-5 6 2.78% | |
1-2-6 6 2.78% | |
1-3-3 3 1.39% | |
1-3-4 6 2.78% | |
1-3-5 6 2.78% | |
1-3-6 6 2.78% | |
1-4-4 3 1.39% | |
1-4-5 6 2.78% | |
1-4-6 6 2.78% | |
1-5-5 3 1.39% | |
1-5-6 6 2.78% | |
1-6-6 3 1.39% | |
2-2-2 1 0.46% | |
2-2-3 3 1.39% | |
2-2-4 3 1.39% | |
2-2-5 3 1.39% | |
2-2-6 3 1.39% | |
2-3-3 3 1.39% | |
2-3-4 6 2.78% | |
2-3-5 6 2.78% | |
2-3-6 6 2.78% | |
2-4-4 3 1.39% | |
2-4-5 6 2.78% | |
2-4-6 6 2.78% | |
2-5-5 3 1.39% | |
2-5-6 6 2.78% | |
2-6-6 3 1.39% | |
3-3-3 1 0.46% | |
3-3-4 3 1.39% | |
3-3-5 3 1.39% | |
3-3-6 3 1.39% | |
3-4-4 3 1.39% | |
3-4-5 6 2.78% | |
3-4-6 6 2.78% | |
3-5-5 3 1.39% | |
3-5-6 6 2.78% | |
3-6-6 3 1.39% | |
4-4-4 1 0.46% | |
4-4-5 3 1.39% | |
4-4-6 3 1.39% | |
4-5-5 3 1.39% | |
4-5-6 6 2.78% | |
4-6-6 3 1.39% | |
5-5-5 1 0.46% | |
5-5-6 3 1.39% | |
5-6-6 3 1.39% | |
6-6-6 1 0.46% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment