Over the holidays I came discovered Code Golf and got quite addicted to one of the challenges, for those unfamiliar with it:
Based on the original perl golf, Code Golf allows you to show off your code-fu by trying to solve coding problems using the least number of keystrokes.
You’re not just limited to Perl either - PHP, Python and Ruby are all available too.
Challenges are always open, and your entries are automatically scored so you can start playing right away!
I spent most of the holidays tweeking and tuning my entry for the 99 bottles and managed to get my entry down to 209 bytes. Far from a winning score, but for my first attempt - and using PHP - i’m quite pleased.
The resulting code is pretty much unreadable, no line breaks, single character variable names - and yes, that kind of code should never rear it’ ugly head in serious project, but its a work out for some of the coding muscles you may not use very often or even at all.
So have a go, try one of the challenges stretch your brain a bit, or if you’re learning a new language try one of those and get to know some of the dusty corners of the language you’d other wise miss.
More importantly, have a go at 99 Bottles of Beer and tell me how you did.