← notes

code-golf

Code Golf is a type of programming competition where participants compete to solve problems through writing the least possible characters of code

History

The idea of competitively pruning down program size has itself been recognized for a long time - even early coding manuals dating back to the 1960s discuss it.

However, the term "code golf" was apparently first used in 1999 with Perl, and later popularized through Perl to write programs that performed RSA encrytion.

Golfing Languages

In the name of code golfing, several new programming languages, or esolangs, have been created. Examples include GolfScript, FlogScript, and Vyxal, but there are hundreds more. These examples in particular are turing complete.

Here's an example of GolfScript code that prints the first 1000 digits of pi (all in only 29 bytes!):

1
2
3
;''
6666,-2%{2+.2/@*\/10.3??2*+}*
`50<~;

Further Reading

code.golf
Codegolf Stack Exchange
Codegolf Subreddit
Brainfuck, The Best Esolang
What is Code Golf and Why does it Suck?
Anarchy Golf
Tips For Golfing in Javascript
Golfscript Website
A Brief Introduction to Esoteric Programming

References

[1] "comp.lang.perl.misc email group email from Greg Bacon on May 28, 1999" - groups.google.com
[2] "LAEREBOG 1, KODING FOR GIER" - Regnecentralen, datamuseum.dk
[3] "Code Golf" - Wikipedia, en.wikipedia.org