Can't let it go...
Jan. 11th, 2014 01:09 amIt turns out that some of the Farkel-related numbers I've been seeing take account of the rules of the game, which apparently confer special meaning to dice showing one or five. So I'm not at all sure such numbers are of much help.
And then it struck me: brute-forcing the six dice problem should not be all that hard.
Step 1. Log into my Raspberry Pi web server, open emacs and write a perl program to produce every possible roll of 6 dice.
Step 2. Run the Linux command line
Progress, surely, but Morpheus calls.
And then it struck me: brute-forcing the six dice problem should not be all that hard.
Step 1. Log into my Raspberry Pi web server, open emacs and write a perl program to produce every possible roll of 6 dice.
for ($d1 = 1; $d1 <= 6; $d1++) {Yes, I know: far from elegant. But it gets the job done. I run this program from the command line and I direct its output to allrolls.txt.
for ($d2 = 1; $d2 <= 6; $d2++) {
for ($d3 = 1; $d3 <= 6; $d3++) {
for ($d4 = 1; $d4 <= 6; $d4++) {
for ($d5 = 1; $d5 <= 6; $d5++) {
for ($d6 = 1; $d6 <= 6; $d6++) {
my @roll = sort ($d1, $d2, $d3, $d4, $d5, $d6);
print(@roll, "\n");
}
}
}
}
}
}
Step 2. Run the Linux command line
sort allrolls.txt | uniq -c > uniquerolls.txtWhat this command line does is sort the allrolls.txt file and creates an output file (uniquerolls.txt)where duplicate lines are replaced with a single line that's prefaced by the number of duplicates found in the input file, e.g.:
1 111111If I count the number of lines in the file uniquerolls.txt, it turns out there are only 462 different combinations of 1, 2, 3, 4, 5 and 6 possible with 6 dice, though some (112456, which can occur 360 different ways) are more probable than others (111111, which can occur in exactly one way).
6 111112
6 111113
6 111114
6 111115
6 111116
15 111122
30 111123
30 111124
30 111125
30 111126
...
Progress, surely, but Morpheus calls.