Freely available books for code golfing?

14

5

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

RoflcoptrException

Posted 2011-01-29T16:51:31.820

Reputation: 111

Question was closed 2017-02-24T18:04:46.517

1@Joey: So are you saying that no books on leisure activities are ever published? – Chris Laplante – 2011-01-29T17:44:49.270

1

Relevant: see the tips tag

– marcog – 2011-01-30T09:19:19.197

Due to the evolution of this site over the years, I would say PPCG is now the best resource for learning code-golf in almost any language it's practiced in. – lirtosiast – 2019-02-07T20:34:31.183

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. – None – 2011-01-31T19:48:24.267

Answers

8

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

hallvabo

Posted 2011-01-29T16:51:31.820

Reputation: 1 640

7

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

Chris Jester-Young

Posted 2011-01-29T16:51:31.820

Reputation: 4 464

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 – 2011-01-30T15:26:25.943

@hallvabo: I should add a Scheme golfing tips section once I collect a few, too. :-P – Chris Jester-Young – 2011-01-30T15:28:17.800

7

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.

hallvabo

Posted 2011-01-29T16:51:31.820

Reputation: 1 640

2Having fun while exploring the depths of a language only cripples an already weak mind incapable of creative thought. – None – 2011-01-31T19:49:30.147

4

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

AShelly

Posted 2011-01-29T16:51:31.820

Reputation: 4 281