http://www.perlmonks.org?node_id=41356

in reply to RE: X-treme P-ondering

Yes, and that 5XP a day from voting looks even smaller when you consider that the same person is also getting a free 2XP every day just for logging in.

On a related metter, a couple of days ago I got to wondering how big the voting bonus really was. An Acolyte gets 8 votes per day, so it's easy to see that the Acolyte can expect to acquire an extra 2 XP from casting votes. (Not counting an additional bonus of 2 XP for using them all up.) But the 2XP is really a 25% chance of 1 XP for each vote, so the Acolyte might be lucky and get more XP, or unlucky and get none at all.

```my \$n = shift || 8;
my \$p = shift || .25;

for (\$i=0; \$i<=\$n; ++\$i) {
my \$prob = choose(\$n,\$i) * (\$p**\$i) * ((1-\$p)**(\$n-\$i));
\$x += \$i * \$prob;
\$tp += \$prob;
printf "%2d %.4f\t(%.4f)\n", \$i, \$prob, 1-\$tp;
}
print "Expected: \$x\n";

sub choose {
my (\$n, \$r) = @_;
return 0 if \$n < 0 || \$r < 0 || \$r > \$n;
return 1 if \$r == 0 || \$r == \$n;
return choose(\$n-1,\$r-1) * \$n / \$r;
}
(THe program will run When you run this, you can give it an argument which is the number of votes you get per day; it defaults to 8. Then it prints out a table showing the probability of getting each possible number of XP:

``` 0 0.1001       (0.8999)
1 0.2670       (0.6329)
2 0.3115       (0.3215)
3 0.2076       (0.1138)
4 0.0865       (0.0273)
5 0.0231       (0.0042)
6 0.0038       (0.0004)
7 0.0004       (0.0000)
8 0.0000       (0.0000)
Expected: 2