Golf

From Esolang
(Redirected from Code golf)
Jump to navigation Jump to search
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).

See also

External resources