International Obfuscated C Code Contest: Difference between revisions

Content deleted Content added
Flight simulator: Add screenshot
m typo; better ref; simplify quote farm.
Line 64:
Entries often employ strange or unusual tricks, such as using the C preprocessor to do things it was not designed to do, or avoiding commonly used constructs in the C programming language in favor of much more obscure ways of achieving the same thing. Two contest winners generated a list of prime numbers using the C preprocessor "spectacularly", according to ''Dr. Dobbs''.<ref>{{cite web|url=http://www.drdobbs.com/open-source/code-finessing/193104882?pgno=2 |title=Code Finessing |magazine=[[Dr. Dobb's Journal]]|author= Spinellis, Diomidis |date=October 5, 2006 |access-date=2013-04-07}}</ref> Some quotes from 2004 winners include:
 
{{quote|text=To keep things simple, I have avoided the C preprocessor and tricky statements such as "if", "for", "do", "while", "switch", and "goto".''<ref>[http://www.ioccc.org/2004/burley.hint IOCCC 2004 – Best Calculated Risk]. IOCCC. Retrieved 2013-04-08.</ref>}}
 
{{quote|text=We still aren't sure whether or not this is a useful program, but it's the first atomic fission we've seen in the IOCCC.<ref>[http://www.ioccc.org/2004/jdalbec.hint IOCCC 2004 – Best abuse of the Periodic table]. IOCCC. Retrieved 2013-04-08.</ref>}}
 
{{quote|text=Why not use the program to hide another program in the program? It must have seemed reasonable at the time.<ref>[http://www.ioccc.org/2004/sds.hint IOCCC 2004 – Best abuse of Indentation]. IOCCC. Retrieved 2013-04-08.</ref>}}
 
{{quote|text=The program implements an 11-bit [[Arithmetic logic unit|ALU]] in the [[C preprocessor]].<ref name="cpp_abuse">[http://www.ioccc.org/2004/vik2.hint IOCCC 2004 – Best Abuse of CPP]'' IOCCC. Retrieved 2013-04-08.</ref>}}
 
{{quote|text=I found that calculating prime numbers up to 1024 makes the program include itself over 6.8 million times.<ref name="cpp_abuse" />}}
 
Contributions have included source code formatted to resemble images, text, etc., after the manner of [[ASCII art]], preprocessor redefinitions to make code harder to read, and [[self-modifying code]]. In several years, an entry was submitted that required a new definition of some of the rules for the next year.{{citation needed|date=April 2013}} This is regarded as a high honor. An example is the world's shortest [[Quine (computing)|self-reproducing program]]. The entry was a program designed to output its own source code, and which had zero bytes of source code. When the program ran, it printed out zero bytes, equivalent to its source code.<ref>{{cite web|year=1994|title=smr.hint|url=https://www.ioccc.org/1994/smr.hint|access-date=2006-09-16|publisher=IOCCC|format=plain text}}</ref>
Line 200:
)/107e2)*_; D=cos(o); E=sin(o); } }
</syntaxhighlight>
[[File:1998_IOCCC_Flight_simulator_screenshot.png|thumb|Pittsburgh scenery of the Flight simulator.]]
This program needs the following command line on a Linux system to be compiled:<ref name=":0" />
<pre>
Line 208:
</pre>
 
In order to run the binary file ({{code|banks}}) it has to be supplied with a {{code|.sc}}-enery senery file via [[standard input|{{code|stdin}}]] input:<ref>{{Cite web|titlename=Previous":0" IOCCC Winners with spoilers|url=https://www.ioccc.org/years-spoiler.html|access-date=2021-03-08|website=www.ioccc.org}}</ref>:
<syntaxhighlight lang=shell> cat pittsburgh.sc | ./banks </syntaxhighlight>