1960: Code Golf
Title text: I also enjoy Reverse Regular Golf. I've been playing for years all across the country and I'm still on the first hole.
This was the first comic in the My Hobby series in over a year. It directly followed the second Fun fact comic in the same month, 1959: The Simpsons, after more than two years break from that series. It seems that Randall returned to his old themes this month.
Code golf is the attempt to use as few characters as possible to write a computer program with a certain function, analogously to regular golf's goal of getting the ball into the hole with as few strokes as possible. Reverse code golf would be to write a given program, probably to achieve a trivial outcome, using as many characters as possible. Randall's approach to this in the code example shown in the comic is to create overly long function names, using the beginning lines of Herman Melville's notoriously long-winded whaling novel Moby-Dick. Regular code golf also results in names of functions and variables that have nothing to do with their purpose in the program, but would minimise their length.
Using "as many characters as possible" to produce code is known as "Code Bowling" in the code golf space. Code bowling challenges usually come the requirement of being "pristine" meaning every substring of the code is necessary, and also often have restrictions on whitespace and identifier length. Without these restrictions it would be a trivial task to make any given program longer by inserting useless code or comments. Furthermore, some programming languages place no limit on function names, so these could simply be made longer. The program listed here would not meet the requirements of most challenges. The code is written in a programming language that looks similar to Python, but with the keyword “define” instead of “def” to define functions. Python has no limit for function name length, and was previously featured in comic 353: Python.
The first two functions defined implement “zero” and “successor”, the two basic operations of Peano arithmetic. Presumably, the programmer will next implement natural number addition, then integers, then whichever branches of mathematics the original problem needs, all from scratch. Generally, you would use built-in functions to perform mathematical operations, so it is redundant to implement them yourself from scratch.
The title text suggests that Randall has also invented a reverse version of regular golf, where the aim is to take as many strokes as possible to get the ball in the hole. Similarly to Reverse Code Golf, the only challenge here would be the player's own boredom threshold, since they could always add more strokes by tapping the ball in a direction other than that of the hole. Alternatively, he actually plays golf in reverse, starting from the hole (or pin) and hitting the ball towards the tee (he may or may not also be playing in the opposite direction of the hole layout established by the organisation which manages the course). This would however, be a flagrant violation of the Laws and Customs of Golf, as it interferes with other players' games and some aspects are impossible or unpractical (if Randall takes the view that the ball should start in the hole, the rules prohibit using any clubs to remove it in that it would damage the hole, and he would have to putt off the green).
The comment that he has "been playing for years all across the country and [is] still on the first hole" is ambiguous. Normally, when a golfer says they have been playing all across the country they mean that they have played rounds at many different courses. Randall could be implying the same, but that he's never finished the first hole (which, as noted above, would hardly be surprising), and so still counts it as playing one continuous first hole. Alternatively, he may literally mean that he has been playing the ball continuously across the whole country. Under normal golf rules this would result in his shots going "Out of Bounds" when it went beyond the boundaries of the original course. In one way, this would help him, as he would incur a penalty stroke. However, he would then have to play his next shot from the same spot as the last one, which would hamper him from continuing to play across the country. Since Randall has invented the sport, though, he may have chosen not to include Out of Bounds rules.
Interestingly, the comic ends with an unmatched left parenthesis (something which might be intended to create unresolved tension.
- [There is code written as colored text in a black box (all black text here below is white in the comic):]
- define callMeIshmaelSomeYearsAgoNeverMindHowLongPrecisely():
- return 0
- define havingLittleOrNoMoneyInMyPurseAndNothingParticular(toInterestMeOnShoreIThoughtIWouldSail):
- return 1+toInterestMeOnShoreIThoughtIWouldSail
- define aLittleAndSeeTheWateryPartOfTheWorld(
- [Caption under the black box:]
- My hobby:
- Reverse Code Golf
Revitalizing old themes
- Is Randall revitalizing old themes?
- This was the first comic in the My Hobby series for over a year.
- It also followed directly after the second Fun fact comic in the same month, 1959: The Simpsons, after more than two years break from that series.
- Finally in the very next comic he returned to his problems with Small Talk and social interactions in general in 1961: Interaction, something he last dealt with in three comics released for about two years ago, the last being 1650: Baby.
- This comic also refers to another recurring theme Programming, but there has been no break from this as this was the third of those already in 2018.
- "Reverse code golf" has been mentioned on Code Golf Stack Exchange.
The last line is missing a close-paren.
add a comment! ⋅ add a topic (use sparingly)! ⋅ refresh comments!