Content deleted Content added
Add some of the history of Rule 2 evolution. |
|||
(16 intermediate revisions by 7 users not shown) | |||
Line 20:
|coordinates = <!-- {{coord|LAT|LON|type:event|display=inline,title}} -->
|country =
|years_active = 1984–1996, 1998, 2000, 2001, 2004–2006, 2011–2015,
|first = {{start date|1984}}
|founders = [[Landon Curt Noll]], Larry Bassel
|last =
|prev =
|next = Dec 2025
|participants =
|activity =
Line 39:
|footnotes =
}}
The '''International Obfuscated C Code Contest''' (abbreviated '''IOCCC''') is a [[computer programming]] contest for
Entries are evaluated anonymously by
==History==
The IOCCC was started by [[Landon Curt Noll]] and Larry Bassel in 1984 while employed at National Semiconductor's Genix porting group. The idea for the contest came after they compared notes with each other about some poorly written code that they had to fix, notably the [[Bourne shell]], which used macros to emulate [[ALGOL 68]] syntax, and a buggy version of [[finger (Unix)|finger]] for BSD.<ref>{{cite web |url=https://www.ioccc.org/faq.html#ioccc_start |title=
Compared with other programming contests, the IOCCC is described as "not all that serious" by [[Michael Swaine (technical author)|Michael Swaine]], editor of ''[[Dr. Dobb's Journal]]''.<ref>{{cite journal |url=https://
==Rules==
The Rules<ref name=rules>{{cite web|url=https://www.ioccc.org/next/rules.html|title=Rules|publisher= International Obfuscated C Code Contest | website= IOCCC.org }}</ref> vary from year to year and are posted with a set of Guidelines<ref name=guidelines>{{cite web|url=https://www.ioccc.org/next/guidelines.html|title=Guidelines|publisher= International Obfuscated C Code Contest | website= IOCCC.org }}</ref> that attempt to convey additional enlightenment about the Rules. They are published on the IOCCC website. In addition all material including winning entries are published under [[Creative Commons license]] [[Share-alike|BY-SA]] 4.0 International.<ref>{{cite web| url= https://www.ioccc.org/license.html|title=IOCCC License Employed|publisher= International Obfuscated C Code Contest | website= IOCCC.org| date= | access-date= }}</ref>.
{{
The
The most significant of the Rules is Rule 2a & 2b (originally Rule 1), gross & net source size limits. During the life time of the contest, Rule 2 has evolved<ref>{{cite web|url=https://www.ioccc.org/faq.html#size_rule_history|title=Rule 2 Eras|publisher=International Obfuscated C Code Contest|website=IOCCC.org}}</ref> to accommodate subtle increases in source size limits. The 1984 contest started with a maximum source size of 512 bytes, which increased a few more times to 1536 bytes in 1991. In 1992, Rule 2 was split to distinguish between maximum overall size and maximum size ignoring white space and semicolons given certain conditions. In the early days, in order to make best use of space allowed, white space was stripped, often resulting in a compact blob of text, making it hard to read by humans, but served little purpose once passed through a C "pretty print" utility, which the judges did as part of their process. In 1992 the judges believed that form of obfuscation had played out and they wanted to encourage people to explore other ways of formatting the code, such as an ASCII image themed after the entry, or simply more traditionally indented C source. Around 2012/2013 the iocccsize(1)<ref>{{cite web|url=https://github.com/SirWumpus/iocccsize#history|title=iocccsize|publisher=Anthony C Howe|website=GitHub.com}}</ref> tool was adopted by the contest and tweaked to aid both contestants and judges apply the Rule 2b counting algorithm.
==Obfuscations employed==
Entries often employ strange or unusual tricks, such as using the [[C preprocessor]] to do things it was not designed to do
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 the effort to take obfuscation to its extremes, contestants have produced programs which skirt around the edges of C standards, or result in constructs which trigger rarely used code path combinations in compilers. As a result, several of the past entries may not compile directly in a modern compiler, and some may cause crashes.
==Examples==
Within the code size limit of only a few kilobytes, contestants have managed to do complicated things – a 2004 winner turned out an operating system.<ref>{{cite web| url=https://www.ioccc.org/2004/gavin.hint |title=gavin.hint3 |year=2004 |format=plain text |publisher= International Obfuscated C Code Contest | website= IOCCC.org |access-date=2023-05-01}}</ref>
===Toledo Nanochess===
''Toledo Nanochess'' is a [[chess engine]] created by Mexican software developer Oscar Toledo Gutiérrez, a five-time winner of the IOCCC. In accordance with IOCCC rules, it is 1255 characters long. The author claims that it is the world's smallest chess program written in C.
The source code for ''Toledo Nanochess'' and other engines is available.<ref>{{cite web |url=https://nanochess.org/chess3.html |title=Toledo Nanochess and Toledo Picochess| website= nanochess.org| publisher= | date= | access-date= }}</ref> Because ''Toledo Nanochess'' is based on Toledo's winning entry from the 18th IOCCC (Best Game<ref>{{cite web |url= https://www.ioccc.org/winners.html#Oscar_Toledo_G. |title=Winners: The authors of winning IOCCC entries |publisher=International Obfuscated C Code Contest | website= IOCCC.org |date= | accessdate= }}</ref>), it is heavily [[obfuscated code|obfuscated]].<ref>{{cite web |url=https://github.com/bormand/nanochess |title= Nanochess partially de-obfuscated version |website=[[GitHub]] |date= | publisher= |access-date=1 May 2023}}</ref>
On February 2, 2014, the author published the book ''Toledo Nanochess: The commented source code'', which contains the fully commented source code.<ref>{{Cite book|title=Toledo Nanochess: The commented source code|
As of February 7, 2010, it appears to be one of only two chess engines written in less than 2 kilobytes of C that are able to play full legal chess moves, along with ''Micro-Max'' by Dutch physicist H. G. Muller. In 2014 the 1 kilobyte barrier was broken by ''Super Micro Chess''<ref>{{Cite web|url=https://smmax.sourceforge.net|title=Super Micro Chess Engine - Home Page - Extremely Compact C Source and Executable Program Size|website=smmax.sourceforge.net}}</ref> – a derivative of Micro-Max – totaling 760 characters (spaces and newlines included).<ref>{{cite web |url=https://sourceforge.net/projects/smmax/files/sm-fide%20760.c/download |title= Super Micro FIDE 760| website= sourceforge.net| publisher= | date= | access-date= }}</ref> There is also a smaller version of Toledo's engine, the ''Toledo Picochess'', consisting of 944 non-blank characters.
'''Source code excerpt'''
Line 97 ⟶ 98:
===Pi===
Below is a 1988 entry which calculates [[pi]] by looking at its own [[area]]:<ref>
<syntaxhighlight lang="c">
Line 122 ⟶ 123:
</syntaxhighlight>
(This entry was written in [[K&R C]]; it does not work correctly in ANSI C without some changes.<ref>
===Flight simulator===
Another example is the following flight simulator, the winner of the 1998 IOCCC,<ref name=":0">[https://blog.aerojockey.com/post/iocccsim Carl Banks' Blog: IOCCC Flight Simulator]. blog.aerojockey.com. Retrieved 2023-05-01.</ref> as listed and described in ''Calculated Bets: Computers, Gambling, and Mathematical Modeling to Win'' (2001)<ref>{{cite book |title= Calculated Bets: Computers, Gambling, and Mathematical Modeling to Win |url= https://archive.org/details/calculatedbetsco0000skie |url-access= registration |
<syntaxhighlight lang="c">
Line 189 ⟶ 190:
[[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" />
<syntaxhighlight lang="console">
$ cc banks.c -o banks -DIT=XK_Page_Up -DDT=XK_Page_Down \
-DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
-DCS=XK_Return -Ddt=0.02 -lm -lX11 -L/usr/X11R6/lib
</syntaxhighlight>
In order to run the binary file ({{code|banks}}) it has to be supplied with a {{code|.sc}} scenery file via [[standard input|{{code|stdin}}]] input:<ref name=":0" />
<syntaxhighlight lang=
===Akari===
Below is a 2011 entry which downsamples [[Netpbm#PGM_example|PGM]], [[Netpbm#PPM_example|PPM]] images and ASCII art (of Akari from ''[[YuruYuri]]'') by Don, Yang:<ref>{{Cite web|title=Winners: The authors of winning IOCCC entries |url= https://www.ioccc.org/years.html#2011_akari|publisher=International Obfuscated C Code Contest | website= IOCCC.org |access-date=2023-05-01
<syntaxhighlight lang="c">
Line 247 ⟶ 248:
</syntaxhighlight>
If the program is run using its own source as the input, the result is:
<syntaxhighlight lang="c"> Line 270 ⟶ 272:
* *n/*{i ;w; }_}
( -*/ *00 ) ; }
wm_aoi(n)
Line 282 ⟶ 284:
=* */);/*
**/{ ;;}}
$
main
(){puts("Y"
Line 290 ⟶ 292:
"RI" )/*
*/ ;}
$
</syntaxhighlight>
Line 298 ⟶ 300:
*[[Esoteric programming language]]
==Notes
{{notelist}}
==References==
{{reflist}}
==External links==
|