|There's more than one way to do things|
When One Golfer Speculates On What Another Is Doing...by eyepopslikeamosquito (Chancellor)
|on Aug 01, 2009 at 03:07 UTC||Need Help??|
Though I can't comment on the 176 char bottles of beer solution that "SplinterFL" was referring to, please note that my 168 char solution uses just a humble sub and a lowly print statement inside a simple for loop. No need for any "string compression of the code".
As for my 134 character PHP saving time solution, I'm happy to reveal that it does not "run a Perl solution through PHP's shell command functions". It's just plain old PHP code. No dirty tricks. Just the usual blood, toil, tears and sweat.
Why on Earth do beginning golfers indulge in such unfounded speculations? I don't know but a possible answer can be found by remembering one of Beth's many insightful responses where she perceptively noted that:
In the late 1990's Justin Kruger and David Dunning did a series of studies demonstrating that the less skillful had a tendency to overrate their abilities and fail to recognize expertise in others.
Anyway, after reading Abdulla's 234 char PHP solution to the codegolf Saving Time challenge, namely:
I refined his interesting approach into a (shortened) 132 stroke Perl solution as follows:
To clarify precisely what problem this code is solving, and to make it easier to test possible solutions, I've written a test program as follows:
You can test possible solutions by running:
Note that the 132 stroke Perl solution given above is just a random example solution to give you a working solution to this problem. Better approaches are available.
Please feel free to golf this code. Or speculate on the general approach I took to get down to 101 strokes. If you do happen to speculate correctly, I'd be happy to congratulate you and confirm a correct speculation. I'm writing this node for fun and to see if the above two wildly-off-the-mark speculations are really representative ... or if most golfers can speculate rather better than that. :-)
Update: After this node was written, I described most of the interesting solutions I'm aware of for both the Saving Time and 99 Bottles of Beer golf games at: