The Other Kind of Turkey
It's Elf Bowling Time Again
Every year, as Christmas approaches, it's time once again to update our email filters to bitbucket all the "elf bowling!!!" emails from friends and family. I've never understood the appeal of ELFBOWL.EXE, but I guess I can say one thing for it: it gets me thinking about bowling, again. I used to really enjoy bowling, but I haven't gone out to the lanes in ages. Living in New England made me stop thinking about it much, because almost all bowling up there is of a strange, abominable variation.
When the Nintendo Wii came out, though, I got hooked on bowling again, and realized that although I had always enjoyed the game, I really never understood how to score it. What better way to learn than to implement a CPAN module for tracking bowling scores? Probably many, but that's the one I picked!
Here's the sort of scorecard I might get to fill out on a good day. (I said I liked bowling, not that I was good at it!)
If you're a much better bowler, you might get to make this excellent invocation:
Displaying Score Cards
Of course, printing a number to the screen isn't very satisfying. Part of the joy of bowling is watching all the bizarre math and symbols get drawn on the big overhead screen. We could tack this onto my game above...
And we'll get this extremely satisfying output:
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-------+ | 6 1 | 7 2 | X | 9 / | X | X | X | - - | 8 / | X 9 / | | 7 | 16 | 36 | 56 | 86 | 106 | 116 | 116 | 136 | 156 |
If you know how to bowl, you probably know how to keep score, so you're not going to be saving a lot of time by keying in your scores to a Perl program. You could easily enough throw together a ReadLine-based program to keep track of turns and scores, but I think those uses are never going to be big wins over transparencies and grease pencils.
No, I think that the big hot application for Games::Bowling::Scorecard will come with the growing resurgence of SDL Perl. Pretty soon, dozens of graphical bowling games written in Perl will be in the works, and they'll all be easier to write thanks to Games::Bowling::Scorecard. I look forward to the day when the ELFBOWL2.EXE that I angrily delete is compiled from Perl, using my own code.