Tuesday, July 7, 2009

Dice Game Again

After seeing Daniel Ruoso's lovely version, I decided to take another crack at the the dice game:

Notice that once the payback subroutine is defined, the all the calculations are done with a simple one-liner, followed by a single say to print the results, and then wrapped with MAIN to produce a command-line interface. Wee!

Alas, I believe this would be the slowest version yet but for the fact I replaced * with $_ in the given / when statement.

No comments:

Post a Comment