While researching tpr02, I stumbled across perhaps the earliest example of an organised golf competition:
http://groups.google.com/groups?hl=en&selm=37DD324C.A984C7A9%40wins.uva.nl http://groups.google.com/groups?hl=en&selm=37DE7E5D.1C172E3E%40wins.uva.nl If anyone knows of an earlier example, please let me know. The specification was loose as a goose, there was no test program and no updated leaderboard. The 7 competitors were: Abigail, Steven Alexander, David Alan Black, Neko, Gareth Rees, Steven de Rooij and James Wetterau. Hole 1 was won by Gareth Rees, Hole 2 by Steven Alexander, Hole 3 by tournament host and referee, Steven de Rooij. Imagine the uproar today if a referee were to declare himself the winner of a hole! ;-) Though I love the term "Tight Coding", it is perhaps surprising that "Perl Golf" was not used, given that Greg Bacon coined the term on the same comp.lang.perl.misc mailing list four months previously: http://groups.google.com/groups?hl=en&selm=7imnti%24mjh%241%40info2.uah.edu Here is the best "all anagrams on one line" solution, produced by a team of all 7 players during the post mortem: 53 strokes: #!perl -ln $x{join"",sort split//}.="$_ "}{/ ./&&print for%x The tournament host described this as a "gem" and waxed lyrically: "If anyone knows how to squeeze another byte out of this I will start uttering strange noises". Well, I would not use the word 'gem' to describe it. ;-) You can see how the general standard of golf has improved! A present-day golfer would replace 'split//' with '/./g' in about four nano-seconds. The post-mortem solution above is easily improved by 9 strokes: 44 strokes: #!perl -ln $x{1,sort/./g}.="$_ "}{/ ./&&print for%x as indeed now appears on the author's web site: http://gene.wins.uva.nl/~srooij/programming/oneliners.html We can save another stroke with: 43 strokes: #!perl -lp $x{1,sort/./g}.="$_ "}for(grep/ ./,%x){ Can anyone do better? /-\ndrew
