Add preview of 1984-2019

The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.

One will find HTML commented out with:

    <!-- XXX remove when 2020 is ready
    2020 links here
    XXX remove when 2020 is ready -->

The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks.  Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known.  The following files
have such HTML comment blocks in them.

    ./winners.html
    ./years-spoiler.html
    ./years.html

In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.

The 2020 winner code AND write-ups are NOT part of this set.

p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
Landon Curt Noll committed 2020-12-30 16:57:03 -08:00
1 parent 28efc67f5d
commit c0663537cb
1683 files changed
+220064

No files matched your search

+256
View File
@@ -0,0 +1,256 @@
#!/usr/bin/env make
#
# 2015 makefile
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
################
# tool locations
################
#
SHELL= /bin/bash
CP= cp
CPP= cpp
GUNZIP= gunzip
BUNZIP2= bunzip2
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
MKDIR= mkdir
MV= mv
TR= tr
GREP= grep
SORT= sort
UNIQ= uniq
# Set X11_LIBDIR to the directory where the X11 library resides
#
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
#
#CWARN=
#CWARN= -Wall
#CWARN= -Wall -Wextra
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
#CWARN= -Wall -Wextra -Weverything
#CWARN= -Wall -Wextra -Weverything -pedantic
#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE}
# Silence warnings that ${CWARN} would normally complain about
#
#CSILENCE=
CSILENCE= -Wno-shift-op-parentheses -Wno-implicit-function-declaration \
-Wno-unused-parameter -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-shadow
# compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c11
# compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# defines that are needed to compile
#
CDEFINE=
# include files that are needed to compile
#
#CINCLUDE=
CINCLUDE= -include stdlib.h
# optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
##############################
# Special flags for this entry
##############################
#
ENTRY= prog
CSRC= ${ENTRY}.c
OBJ= ${ENTRY}.o
DATA=
ALT_OBJ=
ALT_ENTRY=
TARGET= ${ENTRY}
#################
# build the entry
#################
#
all: ${TARGET} ${DATA}
@${TRUE}
${ENTRY}: ${CSRC}
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${OBJ} ${ALT_OBJ}
clobber: clean
${RM} -f ${TARGET} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
install:
@echo "Surely we are joking Dr. May!"
@${TRUE}
# backwards compatibility
#
build: all
@${TRUE}
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
make:
@echo 'Attend a maker faire'
@${TRUE}
easter_egg:
@echo you expected to sometimes mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from not failing to be unable to not partly misunderstand this partocular final echo.
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v5; \
else \
echo "planet deniers, like the IAU, are amusing"; \
fi
@echo A $@ helps ${MAKE} the elements that help form planets
@${TRUE}
deep_magic:
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 2ed3582ec5c094a093fea2a6bcb9f19439892873c9cc45ed1ceaafe08b7d52e1b2c7cd524be3b0b2 --FNV1a_hash_512_bit "${ENTRY}"; \
else \
echo "You are holding it wrong!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_512_bit "${ENTRY}"; \
else \
echo "These aren't the primes you're looking for Pauline!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: supernova
@echo $@ is a dwarf planet
@echo dwarf is a type of planet
@echo $@ is a planet
pluto: supernova
${MAKE} charon
@echo $@ is a dwarf planet
@echo dwarf is a type of planet
@echo $@ is a planet
@echo get used to having lots of planets because a $< can ${MAKE} a lot of them
+157
View File
@@ -0,0 +1,157 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link rel="stylesheet"
type="text/css"
href="../hint.css">
<title>Most Compact</title>
</head>
<body>
<h1>Most Compact</h1>
<p>Chris Mills<br>
Twitter: @MisterXopher</p>
<h2>Judges' comments:</h2>
<h3>To use:</h3>
<pre><code>make
./prog compressed_file.Z
</code></pre>
<h3>Try:</h3>
<pre><code>printf '000I\236\f\31H\260\240\301\203' &gt; ioccc.Z
./prog ioccc.Z
dd bs=1k count=4096 &lt; /dev/urandom &gt; test1
compress &lt; test1 &gt; test1.Z
time ./prog test1.Z | cmp - test1
dd bs=1k count=4096 &lt; /dev/zero &gt; test2
compress &lt; test2 &gt; test2.Z
time ./prog test2.Z | cmp - test2
</code></pre>
<h3>Selected Judges Remarks:</h3>
<p>Without ASCII art, the source code of this entry would have been exactly 256 bytes.
Compared to <a href="http://ioccc.org/years.html#1990_jaw">1990/jaw</a>, it is very impressive,
even taking into account the missing atob functionality. Now we wish for a compress(1)-like compressor
using a similar idea.</p>
<p>Why is the sad smiley on line 12 in that particular place?</p>
<h2>Author&rsquo;s comments:</h2>
<h1>The Program</h1>
<p>This program is in implementation of the unix <code>zcat(1)</code> command for printing
compressed files that have been created by the <code>compress(1)</code> command.</p>
<p>The adaptive <a href="https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch">LZW</a> compression
employed by <code>compress</code> usually requires a fairly large amount of memory to
build the decompression tables (in fact, <code>compress</code> has a command-line option
to control the size of the decompression tables, since some of the early
systems to which it was ported (<em>cough</em>MS-DOS<em>cough</em>) did not have enough
memory to use the full 16-bit codes). This version has no large static or
dynamic tables. It is able to decompress 16-bit files using a single function
and a few ints.</p>
<p>To run the program, take an existing compressed file and pass it to the program
on the command line. On the odd chance you don&rsquo;t have <code>compress</code> hanging about
on your system, I&rsquo;ve provided compressed copies of this year&rsquo;s IOCCC rules
and guidelines files. To print them, just do</p>
<pre><code>./prog ioccc_guidelines.txt.Z
</code></pre>
<h2>The Details</h2>
<p>The basic cleverness here comes from realizing that the compressed data is
itself an encoded version of the code dictionary. When the encoder sees
an input string that is not in its dictionary, it emits the code corresponding
to the longest prefix that is in the dictionary and adds a new entry consisting
of that code followed by the next input character. This means that when the
decoder wants to know how to decode a code, it just needs to find the spot in
the code-stream where the encoder added that entry to the dictionary. The
code at that spot is the prefix, and the first character of the following code
is the suffix. Decoding then just becomes recursion, to follow the chain of
prefixes and suffix characters.</p>
<p>Of course, it&rsquo;s not nearly that simple. Finding the code in the stream is
complicated by several issues:</p>
<ul>
<li>Codes are at bit offsets within the stream, and must be extracted.</li>
<li>As codes are added to the dictionary, the code word size grows, so finding
the offset to a particular code word is involved.</li>
<li>The <code>compress</code> encoder reserves a code word that clears the coding tables.
When this is encountered, the computation of offsets and bit sizes reset.</li>
<li>The <code>compress</code> decoder is designed to always read a block of eight code
words at the same time, so that it need only read N bytes to get eight N-bit
code words. When the &ldquo;clear&rdquo; code is encountered, the entire eight-word
block is flushed (since the decoder didn&rsquo;t know the word size would change).
The program needs to account for this extra flushing.</li>
<li>The end of the stream is not explicitly marked; the encoder just pads out
the output to the next byte. The decoder must notice this to know when
to stop.</li>
<li>The output stream contains a header that must be skipped.</li>
</ul>
<p>Managing all the details involved added a lovely additional layer of
obfuscation to the otherwise elegant recursive decoder. Still, the code
manages it in a remarkably small amount of code.</p>
<h2>Limitations</h2>
<p>The decoder doesn&rsquo;t look at the header. If you supply something that is not
compressed data, it&rsquo;s likely to crash in an interesting manner.</p>
<p>In particular, it doesn&rsquo;t look at the third byte of the header, which encodes
the maximum code word size and whether &ldquo;block mode&rdquo; was used when the encoder
was run. If you use <code>compress</code> in its default mode, the maximum word size
will be 16 bits and &ldquo;block mode&rdquo; will be enabled. You are unlikely to find
any files that don&rsquo;t use &ldquo;block mode&rdquo;, since all versions of <code>compress</code> after
2.0 (circa 1984) use it by default and have no documented way to disable it.
Reducing the bit depth is still possibly by using the <code>-b</code> flag. Modern
systems have no problem with the 200 KB or so needed for 16-bit decoder
tables, so the need for reducing the table size has passed, hence this program
always assumes 16-bits&hellip; However, should you find a file that needs a
smaller table, feel free to change the hard-coded 16 in the source into the
appropriate number and recompile.</p>
<p>In the event that you don&rsquo;t supply an argument, or that argument doesn&rsquo;t name
a readable file, the program will just silently exit. This is a feature.</p>
<p>The program depends on having a little-endian system. On a big-endian system
you will get a wierd big-endian version of <code>compress</code>, which might have come to
pass in an alternate universe where the vax on which <code>compress</code> was authored
had been big-endian. Luckily for us, it wasn&rsquo;t, and neither are most of the
systems you might want to compile this for.</p>
<hr />
<!--
(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
<TABLE><TR>
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
<TD><P>&copy; Copyright 1984-2016,
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
- All rights reserved<BR>
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
<TD>&nbsp;<!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
</TR></TABLE>
</body>
</html>
+131
View File
@@ -0,0 +1,131 @@
# Most Compact
Chris Mills
Twitter: @MisterXopher
## Judges' comments:
### To use:
make
./prog compressed_file.Z
### Try:
printf '000I\236\f\31H\260\240\301\203' > ioccc.Z
./prog ioccc.Z
dd bs=1k count=4096 < /dev/urandom > test1
compress < test1 > test1.Z
time ./prog test1.Z | cmp - test1
dd bs=1k count=4096 < /dev/zero > test2
compress < test2 > test2.Z
time ./prog test2.Z | cmp - test2
### Selected Judges Remarks:
Without ASCII art, the source code of this entry would have been exactly 256 bytes.
Compared to [1990/jaw](http://ioccc.org/years.html#1990_jaw), it is very impressive,
even taking into account the missing atob functionality. Now we wish for a compress(1)-like compressor
using a similar idea.
Why is the sad smiley on line 12 in that particular place?
## Author's comments:
The Program
===========
This program is in implementation of the unix `zcat(1)` command for printing
compressed files that have been created by the `compress(1)` command.
The adaptive [LZW](https://en.wikipedia.org/wiki/Lempel–Ziv–Welch) compression
employed by `compress` usually requires a fairly large amount of memory to
build the decompression tables (in fact, `compress` has a command-line option
to control the size of the decompression tables, since some of the early
systems to which it was ported (*cough*MS-DOS*cough*) did not have enough
memory to use the full 16-bit codes). This version has no large static or
dynamic tables. It is able to decompress 16-bit files using a single function
and a few ints.
To run the program, take an existing compressed file and pass it to the program
on the command line. On the odd chance you don't have `compress` hanging about
on your system, I've provided compressed copies of this year's IOCCC rules
and guidelines files. To print them, just do
./prog ioccc_guidelines.txt.Z
The Details
-----------
The basic cleverness here comes from realizing that the compressed data is
itself an encoded version of the code dictionary. When the encoder sees
an input string that is not in its dictionary, it emits the code corresponding
to the longest prefix that is in the dictionary and adds a new entry consisting
of that code followed by the next input character. This means that when the
decoder wants to know how to decode a code, it just needs to find the spot in
the code-stream where the encoder added that entry to the dictionary. The
code at that spot is the prefix, and the first character of the following code
is the suffix. Decoding then just becomes recursion, to follow the chain of
prefixes and suffix characters.
Of course, it's not nearly that simple. Finding the code in the stream is
complicated by several issues:
* Codes are at bit offsets within the stream, and must be extracted.
* As codes are added to the dictionary, the code word size grows, so finding
the offset to a particular code word is involved.
* The `compress` encoder reserves a code word that clears the coding tables.
When this is encountered, the computation of offsets and bit sizes reset.
* The `compress` decoder is designed to always read a block of eight code
words at the same time, so that it need only read N bytes to get eight N-bit
code words. When the "clear" code is encountered, the entire eight-word
block is flushed (since the decoder didn't know the word size would change).
The program needs to account for this extra flushing.
* The end of the stream is not explicitly marked; the encoder just pads out
the output to the next byte. The decoder must notice this to know when
to stop.
* The output stream contains a header that must be skipped.
Managing all the details involved added a lovely additional layer of
obfuscation to the otherwise elegant recursive decoder. Still, the code
manages it in a remarkably small amount of code.
Limitations
-----------
The decoder doesn't look at the header. If you supply something that is not
compressed data, it's likely to crash in an interesting manner.
In particular, it doesn't look at the third byte of the header, which encodes
the maximum code word size and whether "block mode" was used when the encoder
was run. If you use `compress` in its default mode, the maximum word size
will be 16 bits and "block mode" will be enabled. You are unlikely to find
any files that don't use "block mode", since all versions of `compress` after
2.0 (circa 1984) use it by default and have no documented way to disable it.
Reducing the bit depth is still possibly by using the `-b` flag. Modern
systems have no problem with the 200 KB or so needed for 16-bit decoder
tables, so the need for reducing the table size has passed, hence this program
always assumes 16-bits... However, should you find a file that needs a
smaller table, feel free to change the hard-coded 16 in the source into the
appropriate number and recompile.
In the event that you don't supply an argument, or that argument doesn't name
a readable file, the program will just silently exit. This is a feature.
The program depends on having a little-endian system. On a big-endian system
you will get a wierd big-endian version of `compress`, which might have come to
pass in an alternate universe where the vax on which `compress` was authored
had been big-endian. Luckily for us, it wasn't, and neither are most of the
systems you might want to compile this for.
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2016, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->
Binary file not shown.
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
int I=256,l,c, o,O=3; void e(
int L){ o=0; for( l=8; L>>++l&&
16>l; o+=l
<<l- 1) ;
o+=l *L-(l<<l-1); { ; }
if ( pread(3,&L,3,O+o/8)<
2)/* */exit(0); L>>=7&o;
L%=1 <<l; L>>8?256-L?e(
L-1) ,c||
(e(c =L),
c=0) :( O
+=(-I&7)*l+o+l>>3,I=L):putchar(
L); }int main(int l,char**o){
for(
/* //// */
open(1[o],0); ; e(I++
)) ;}