Golf
- Not to be confused with Golf (A).
Golf is basically the space-optimization of programs for sport - who can write the shortest program that does X in programming language Y?
The term probably attained coinage from Perl Golf. Prior to this, the activity was sometimes referred to as cramming or code-bumming (although the latter does not necessarily refer to space optimization).
Although there were some early informal contests to write small Befunge programs, the favourite esoteric programming language in which to play Golf is probably Brainfuck, in which Golf tournaments are irregularly held.
Several esolangs can be considered to have come about by means of (non-competitive) Golf, with the task being "compile or interpret a programming language" and the programming language being assembly language (but with the result measured in bytes of machine language). These esolangs would be:
- False, with a compiler written in 1024 bytes of Motorola 68000 machine language
- Shelta, with a compiler written in 512 bytes of Intel 80286 machine language
- Brainfuck, with a compiler written in 240 bytes of Motorola 68000 machine language
- Barely, with an interpreter written in 59 bytes of Intel x86 machine language
- MinISCule, with an interpreter written in 36 bytes of Intel x86 machine language
- MiniMAX, with Intel 8086 machine language interpreters written in from 13 to 32 bytes (depending on what counts as cheating; all take input that contains nonprintable characters, some have no I/O, some have extensions that require inline x86 machine code in the MiniMAX program, and some require the MiniMAX program to be appended to the interpreter).
A more recent development is a genre of languages, "golfing languages" designed to allow programs to be written very tersely. These straddle the lines between practical and esoteric programming languages; they are typically much more usable than a typical esoteric language, and often cover very powerful concepts in order to make tasks shorter to express, but because the syntax is designed for terseness rather than readability the programs often look like esolang programs rather than practical programs. Additionally, programs written in golfing languages are typically much harder to modify once written than programs written in practical programming languages.
See also
- GolfScript
- Golf/Feature golf
- Category:Golfing language for a list of golfing languages
External resources
- Code golf on Wikipedia
- Brainfuck Golf
- Code Golf site supporting some esoteric languages.
- GolfScript, a language designed for winning code golf competitions
- Code Golf and Coding Challenges Stack Exchange