Can you recommend any freely available books about code golfing in general and especially in Java and C++?
4 Answers
There are at least two books about golfing:
"Short Coding" by Ozy (only available in Japanese I think, search for it on www.amazon.co.jp)
The Perlgolf History book, available here.
Other recommended reading:
Andrew Savige's (eyepopslikeamosquito) articles on golf, accessible from his node on perlmonks
The language specific forums over on codegolf.com
The solutions to finished challenges on golf.shinh.org (look for "post-mortem").
Mark Byers maintains a golfing tips site. It's not a book per se, but, you may find some gems there!
-
\$\begingroup\$ Unfortunately, it hasn't been updated in quite a while. I will eventually update the Python section a bit, but don't hold your breath... \$\endgroup\$– hallvaboCommented Jan 30, 2011 at 15:26
-
\$\begingroup\$ @hallvabo: I should add a Scheme golfing tips section once I collect a few, too. :-P \$\endgroup\$ Commented Jan 30, 2011 at 15:28
When it comes to golfing in Java, it's not to be recommended.
Actually, I would go so far as to say (paraphrasing E. W. Dijkstra) that it cripples the mind, and therefore should be regarded as a criminal offense.
If you insist on doing codegolf in Java, all the basic stuff you need is found in java.util.Scanner (parsing input), java.math.BigInteger, and java.lang.String. In addition, the syntax for regexes and print formatting will come in handy.
-
2\$\begingroup\$ Having fun while exploring the depths of a language only cripples an already weak mind incapable of creative thought. \$\endgroup\$– Mike BethanyCommented Jan 31, 2011 at 19:49
"the zen of optimization" by Michael Abrash has a few sections on optimizing assembly code for size. I remember there was a chapter where he squeezed every spare byte out of a ridiculously small sort function.
tips
tag \$\endgroup\$