Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Can you recommend any freely available books about code golfing in general and especially in Java and C++?

share|improve this question
1  
@Joey: So are you saying that no books on leisure activities are ever published? –  Chris Laplante Jan 29 '11 at 17:44
1  
Relevant: see the tips tag –  marcog Jan 30 '11 at 9:19
3  
@Joey "Code Golf is essentially a discipline that is of no use in the real world." That's completely wrong. I'm always amazed when I hear people say this. Code golf is an excellent tool for in-depth exploration of a language, poking about in the nooks and crannies as it were. This can be immensely useful to real world programming and has been for me numerous times. –  Mike Bethany Jan 31 '11 at 19:48

4 Answers 4

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.

share|improve this answer
2  
+1 for "criminal offense" :) –  marcog Jan 30 '11 at 15:59
1  
Having fun while exploring the depths of a language only cripples an already weak mind incapable of creative thought. –  Mike Bethany Jan 31 '11 at 19:49

Mark Byers maintains a golfing tips site. It's not a book per se, but, you may find some gems there!

share|improve this answer
    
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... –  hallvabo Jan 30 '11 at 15:26
    
@hallvabo: I should add a Scheme golfing tips section once I collect a few, too. :-P –  Chris Jester-Young Jan 30 '11 at 15:28

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").

share|improve this answer

"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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.