The Apocrypha
Xref: athena.cs.uga.edu comp.lang.c:22484 comp.sources.d:2493 comp.unix.wizards:7127 alt.sources:3860 misc.misc:5658
Path: athena.cs.uga.edu!emory!gatech!darwin.sura.net!haven.umd.edu!uunet!digibd!merlyn
From: merlyn@digibd.com (Merlyn LeRoy)
Newsgroups: comp.lang.c,comp.sources.d,comp.unix.wizards,alt.sources,misc.misc
Subject: IOCCC APOCRYPHA
Message-ID: [1992Sep09.140446.13093@digibd.com]
Date: 9 Sep 92 14:04:46 GMT
Organization: DigiBoard Incorporated, Eden Prairie, MN
Lines: 1116
This is an unofficial collection of obfuscated C code that (for various
reasons) haven't won the Int'l Obfuscated C Code contest; in brief, apocrypha.
All have been collected by me over usenet, and all are at least two years old
(so they probably aren't IOCCC contenders anymore). The authors' names,
and (in most cases) the authors' original notes are included.
---
Merlyn LeRoy
merlyn@digibd.com
uunet!digibd!merlyn
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh [file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: apocrypha apocrypha/Makefile apocrypha/README
# apocrypha/TMabc apocrypha/TMabc2 apocrypha/TMupdown
# apocrypha/duff.c apocrypha/duff.hint apocrypha/hitz.README
# apocrypha/hitz.hint apocrypha/hoey.hint apocrypha/hoey.pre.c
# apocrypha/hoey2.pre.c apocrypha/ishai.c apocrypha/ishai.hint
# apocrypha/jones.c apocrypha/jones.hint apocrypha/maarten.c
# apocrypha/maarten.hint apocrypha/maze apocrypha/mcfarlane.hint
# apocrypha/mvm.uuencode apocrypha/polyglot.c
# apocrypha/polyglot.hint apocrypha/tm.uuencode apocrypha/tromp.c
# apocrypha/tromp.hint
# Wrapped by merlyn@digibd on Wed Sep 9 09:01:12 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d apocrypha ; then
echo shar: Creating directory \"apocrypha\"
mkdir apocrypha
fi
if test -f apocrypha/Makefile -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/Makefile\"
else
echo shar: Extracting \"apocrypha/Makefile\" \(1030 characters\)
sed "s/^X//" ]apocrypha/Makefile [['END_OF_apocrypha/Makefile'
X#
X# apocrypha makefile
X
XSHELL=/bin/sh
XCC=cc
XCFLAGS=
XRM=rm
XUU=uudecode
X
XENTRIES=duff hoey hoey2 ishai jones maarten polyglot tromp
XFILES=${ENTRIES} tm maze.vi.macros
X
Xall: ${FILES}
X
Xduff: duff.c
X @echo "duff.c is a subroutine, not a complete program"
X
Xhoey.pre: hoey.pre.c
X ${CC} ${CFLAGS} -o hoey.pre hoey.pre.c
X
Xhoey.c: hoey.pre
X (./hoey.pre & true) ] hoey.c
X
Xhoey: hoey.c
X ${CC} ${CFLAGS} -o hoey hoey.c
X
Xhoey2.pre: hoey2.pre.c
X ${CC} ${CFLAGS} -o hoey2.pre hoey2.pre.c
X
Xhoey2.c: hoey2.pre
X (./hoey2.pre & true) ] hoey2.c
X
Xhoey2: hoey2.c
X ${CC} ${CFLAGS} -o hoey2 hoey2.c
X
Xishai: ishai.c
X ${CC} ${CFLAGS} -o ishai ishai.c
X
Xjones: jones.c
X ${CC} ${CFLAGS} -o jones jones.c
X
Xmaarten: maarten.c
X ${CC} ${CFLAGS} -o maarten maarten.c
X
Xpolyglot: polyglot.c
X ${CC} ${CFLAGS} -o polyglot polyglot.c
X
Xtromp: tromp.c
X ${CC} ${CFLAGS} -o tromp tromp.c
X
Xtm: tm.uuencode
X ${UU} tm.uuencode
X
Xmaze.vi.macros: mvm.uuencode
X ${UU} mvm.uuencode
X
Xclean:
X rm -f *.o a.out core hoey.pre hoey2.pre
X
Xclobber: clean
X ${RM} -f ${FILES} hoey.c hoey2.c
X
END_OF_apocrypha/Makefile
if test 1030 -ne `wc -c [apocrypha/Makefile`; then
echo shar: \"apocrypha/Makefile\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/README -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/README\"
else
echo shar: Extracting \"apocrypha/README\" \(576 characters\)
sed "s/^X//" ]apocrypha/README [['END_OF_apocrypha/README'
X
XObfuscated C Apocrypha
X
XThis is a collection of some odd (non-IOCCC winning) bits of (mostly C) code.
XThey mostly fall into three groups:
X
XSelf-reproducing programs
XMultilingual programs
XThe vi Turing machine/maze generator/Turing machine maze solver triad
X
XAll were obtained by me from usenet public postings over the years.
XI have tried to identify the authors in all cases; if you know of
Xany corrections or additions, please send them to me. Many of the
Xemail addresses are probably out-of-date.
X
X---
XMerlyn LeRoy (Brian Westley)
X..uunet!digibd!merlyn
Xmerlyn@digibd.com
END_OF_apocrypha/README
if test 576 -ne `wc -c [apocrypha/README`; then
echo shar: \"apocrypha/README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/TMabc -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/TMabc\"
else
echo shar: Extracting \"apocrypha/TMabc\" \(513 characters\)
sed "s/^X//" ]apocrypha/TMabc [['END_OF_apocrypha/TMabc'
X
X
XSTART{####:####:R:check}
Xcheck{a:a:N:find_b}{b:REJECT:N:HALT}{c:REJECT:N:HALT}{%%%%:ACCEPT:N:HALT}
Xfind_b{a:a:R:find_b}{b:b:L:kill_a1}{c:REJECT:N:HALT}{%%%%:REJECT:N:HALT}
Xkill_a1{a:b:R:find_c}
Xfind_c{b:b:R:find_c}{c:c:L:kill_b2}{%%%%:REJECT:N:HALT}
Xkill_b2{b:c:L:kill_b1}
Xkill_b1{b:c:R:find_end}
Xfind_end{c:c:R:find_end}{%%%%:%%%%:L:kill_c3}
Xkill_c3{c:%%%%:L:kill_c2}
Xkill_c2{c:%%%%:L:kill_c1}
Xkill_c1{c:%%%%:L:RETURN}
XRETURN{a:a:L:RETURN}{b:b:L:RETURN}{c:c:L:RETURN}{####:####:N:START}
X
X####
Xa
Xa
Xb
Xb
Xc
Xc
X%%%%
END_OF_apocrypha/TMabc
if test 513 -ne `wc -c [apocrypha/TMabc`; then
echo shar: \"apocrypha/TMabc\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/TMabc2 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/TMabc2\"
else
echo shar: Extracting \"apocrypha/TMabc2\" \(536 characters\)
sed "s/^X//" ]apocrypha/TMabc2 [['END_OF_apocrypha/TMabc2'
X
XSTART {a:a:L:START} {b:b:L:START} {c:c:L:START} {####:####:R:kill_a}
X {a':a':L:START} {b':b':L:START} {c':c':L:START}
Xkill_a {a:a':R:kill_b} {b:NO:N:NO} {c:NO:N:NO} {%%%%:YES:N:YES}
X {a':a':R:kill_a} {b':b':R:kill_a} {c':c':R:kill_a}
Xkill_b {a:a:R:kill_b} {b:b':R:kill_c} {c:NO:N:NO} {%%%%:NO:N:NO}
X {a':NO:N:NO} {b':b':R:kill_b} {c':NO:N:NO}
Xkill_c {a:NO:N:NO} {b:b:R:kill_c} {c:c':L:START} {%%%%:NO:N:NO}
X {a':NO:N:NO} {b':NO:N:NO} {c':c':R:kill_c}
X
X####
Xa
Xa
Xa
Xb
Xb
Xb
Xc
Xc
Xc
X%%%%
END_OF_apocrypha/TMabc2
if test 536 -ne `wc -c [apocrypha/TMabc2`; then
echo shar: \"apocrypha/TMabc2\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/TMupdown -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/TMupdown\"
else
echo shar: Extracting \"apocrypha/TMupdown\" \(130 characters\)
sed "s/^X//" ]apocrypha/TMupdown [['END_OF_apocrypha/TMupdown'
X
X
XSTART{####:####:R:DOWN}
XDOWN{up:down:R:DOWN}{%%%%:%%%%:L:UP}
XUP{down:up:L:UP}{####:####:R:DOWN}
X
X####
Xup
Xup
Xup
Xup
Xup
Xup
Xup
X%%%%
END_OF_apocrypha/TMupdown
if test 130 -ne `wc -c [apocrypha/TMupdown`; then
echo shar: \"apocrypha/TMupdown\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/duff.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/duff.c\"
else
echo shar: Extracting \"apocrypha/duff.c\" \(378 characters\)
sed "s/^X//" ]apocrypha/duff.c [['END_OF_apocrypha/duff.c'
X
X
X/* A routine that uses Duff's device */
X
Xsend(to, from, count)
Xregister short *to, *from;
Xregister count;
X{
X register n=(count+7)/8;
X switch(count%8){
X case 0: do{ *to = *from++;
X case 7: *to = *from++;
X case 6: *to = *from++;
X case 5: *to = *from++;
X case 4: *to = *from++;
X case 3: *to = *from++;
X case 2: *to = *from++;
X case 1: *to = *from++;
X }while(--n]0);
X }
X}
END_OF_apocrypha/duff.c
if test 378 -ne `wc -c [apocrypha/duff.c`; then
echo shar: \"apocrypha/duff.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/duff.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/duff.hint\"
else
echo shar: Extracting \"apocrypha/duff.hint\" \(2296 characters\)
sed "s/^X//" ]apocrypha/duff.hint [['END_OF_apocrypha/duff.hint'
X
X
XTom Duff
Xucbvax!dagobah!td
X(Nov. '83)
X
XMy comments:
XDuff's device. A well-known useful obfuscated C hack, with notes from
Xthe original author. Not a C program in itself, but it belongs here.
X
X
XAuthor's comments:
XConsider the following routine, abstracted from code which copies an
Xarray of shorts into the Programmed IO data register of an Evans &
XSutherland Picture System II:
X
X send(to, from, count)
X register short *to, *from;
X register count;
X {
X do
X *to = *from++;
X while(--count]0);
X }
X
X(Obviously, this fails if the count is zero.)
XThe VAX C compiler compiles the loop into 2 instructions (a movw and
Xa sobleq, I think.) As it turns out, this loop was the bottleneck in
Xa real-time animation playback program which ran too slowly by about 50%.
XThe standard way to get more speed out of something like this is to unwind
Xthe loop a few times, decreasing the number of sobleqs. When you do that,
Xyou wind up with a leftover partial loop. I usually handle this in C with
Xa switch that indexes a list of copies of the original loop body. Of
Xcourse, if I were writing assembly language code, I'd just jump into the
Xmiddle of the unwound loop to deal with the leftovers. Thinking about this
Xyesterday, the following implementation occurred to me:
X
X send(to, from, count)
X register short *to, *from;
X register count;
X {
X register n=(count+7)/8;
X switch(count%8){
X case 0: do{ *to = *from++;
X case 7: *to = *from++;
X case 6: *to = *from++;
X case 5: *to = *from++;
X case 4: *to = *from++;
X case 3: *to = *from++;
X case 2: *to = *from++;
X case 1: *to = *from++;
X }while(--n]0);
X }
X }
X
XDisgusting, no? But it compiles and runs just fine. I feel a combination
Xof pride and revulsion at this discovery. If no one's thought of it before,
XI think I'll name it after myself.
X
XIt amazes me that after 10 years of writing C there are still little corners
Xthat I haven't explored fully. (Actually, I have another revolting way to
Xuse switches to implement interrupt driven state machines but it's too
Xhorrid to go into.)
X
XMany people (even bwk?) have said that the worst feature of C is that
Xswitches don't break automatically before each case label. This code forms
Xsome sort of argument in that debate, but I'm not sure whether it's for or
Xagainst.
X
X yrs trly
X Tom
END_OF_apocrypha/duff.hint
if test 2296 -ne `wc -c [apocrypha/duff.hint`; then
echo shar: \"apocrypha/duff.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/hitz.README -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/hitz.README\"
else
echo shar: Extracting \"apocrypha/hitz.README\" \(2273 characters\)
sed "s/^X//" ]apocrypha/hitz.README [['END_OF_apocrypha/hitz.README'
X
X Vi Turing Machine Emulation
X ---------------------------
X
XThis directory contains a set of macros which allow vi to simulate a
XTuring Machine. The file "tm" contains the macros. The "TM*" files
Xeach contain a turing machine description.
X
XTo execute the TMupdown machine, do the following:
X
X $ vi TMupdown
X :so tm
X
XThen, from escape mode in vi, type 'g' for go.
X
XI've included a simple turing machine description to use as an example
Xin explaining the format.
X
X--------------------- cut here for sample turing machine -------------------
X
XSTART {####:####:R:DOWN}
XDOWN {up:down:R:DOWN} {%%%%:%%%%:L:UP}
XUP {down:up:L:UP} {####:####:R:DOWN}
X
X####
Xup
Xup
Xup
Xup
X%%%%
X------------------------- end of turing machine ----------------------------
X
XThe blank top line is used as a scratch pad by the macros and must not
Xbe removed. The lines from the second line to the line containing
X"####" encode the turing machine's state table, and the lines from
X"####" to "%%%%" represent the turing machine's tape.
X
XThe tape is lying on its side such that left is up and right is down.
XEach line represents one tape symbol. "####" is the start symbol on
Xthe tape, and "%%%%" is the end symbol.
X
XEach line above "####" represents the information for one state
Xof the turing machine. I'll describe the format using an example:
X
X DOWN {up:down:R:DOWN} {%%%%:%%%%:L:UP}
X
XThe name of the state, in this case "DOWN", comes first. Following that
Xcomes any number of 4-tuples describing the action to take for a particular
Xtape symbol. The first 4-tuple states that if the current tape symbol
Xis "up", then that symbol should be replaced by "down", the current position
Xon the tape should be moved "R" -- that is, to the right -- and the
Xturing machine should enter the "DOWN" state.
X
XThe general format of these 4-tuples is:
X
X '{' [current symbol] ':' [new symbol] ':' [direction] ':' [next state] '}'
X
XWhere [direction] is "R", "L", or "N" for move left, move right, or no move.
XThe other fields can contain any alpha-numeric string. (In fact, any string
Xthat does not include "{}:" or any vi magic characters will probably work.)
X
XWhen a turing machine first starts, after the 'g' command, it is in the
X"START" state with its head positioned on the "####" symbol on the tape.
X
END_OF_apocrypha/hitz.README
if test 2273 -ne `wc -c [apocrypha/hitz.README`; then
echo shar: \"apocrypha/hitz.README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/hitz.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/hitz.hint\"
else
echo shar: Extracting \"apocrypha/hitz.hint\" \(1351 characters\)
sed "s/^X//" ]apocrypha/hitz.hint [['END_OF_apocrypha/hitz.hint'
X
X
XDavid Hitz
Xhitz@mips.COM
X(Feb. '88 UNIX-WIZARDS digest V4#159)
X
XMy comments:
XA set of vi macros to emulate a Turing machine
X
XSee also:
Xmcfarlane.hint (for a turing machine that solves mazes)
Xtromp.hint (for a program that generates the mazes)
X
X
XAuthor's comments:
XTo win a bet I wrote a set of vi macros that let vi simulate a Turing
XMachine. Since Turing Machines are universal computational devices,
Xthis should settle the editor wars debate for once and for all.
X
XOther editors may have better user interfaces than vi, but they are
Xcertainly no more "powerful".
X
XThese macros have been tested on several systems, including versions of
Xboth BSD and SYSV, but since they depend on nits/bugs in vi, some
Xversions of vi could break them.
X
X...
X
XThe following sequence executes the TMupdown turing machine.
X
X 1) Decode the tm file: $ uudecode tm.uuencode
X 2) Edit the TM file: $ vi TMupdown
X 3) Source the macros: :so tm
X 4) From vi ESC mode, type g (for go): g
X
XI've included three turing machine descriptions. TMupdown just moves
Xthe turing machine tape head up and down. TMabc and TMabc2 both
Xrecognize the pattern of N "a"s followed by N "b"s followed by N "c"s
Xfor any integer N.
X
XThe hitz.README file describes the format of the Turing Machines themselves.
XI have an annotated version of the tm macros for people who care.
X
X--
XDave Hitz
END_OF_apocrypha/hitz.hint
if test 1351 -ne `wc -c [apocrypha/hitz.hint`; then
echo shar: \"apocrypha/hitz.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/hoey.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/hoey.hint\"
else
echo shar: Extracting \"apocrypha/hoey.hint\" \(1429 characters\)
sed "s/^X//" ]apocrypha/hoey.hint [['END_OF_apocrypha/hoey.hint'
X
X
XDan Hoey
Xhoey@nrl-aic.arpa
X(Jan '87 comp.lang.c)
X
XMy comments:
XTwo similar self-reproducing C program that do NOT depend
Xon ASCII (i.e. it doesn't putchar(34) to get '"', etc.), and
Xare palindromes to boot!
X
XSince it is awkward to shar source files that have ]80 char lines and
Xdon't have a terminating newline, the sources are distributed as hoey.pre.c
Xand hoey2.pre.c, which have newlines (and a \ inside a string) inserted.
XThese are compiled and run to recreate the original hoey.c and hoey2.c,
Xone of the advantages of self-reproducing programs.
X
X
XAuthor's comments:
XThis argument about portability is all confusion between two usages of
Xthe word. I was speaking of ``formal'' portability, which is
Xdetermined by conformance to standards, as opposed to ``pragmatic''
Xportability, which is determined by the implementations under which a
Xgiven program will operate correctly.
X...
X
XBut my cavil about portability was tongue in cheek; perhaps less
Xobviously than on 31 August 1984 when I accused the writers of
Xself-reproducing programs that operate by reading their source files of
Xignoring the purpose of self-reproducing programs, ``to be a backup, in
Xcase the source is lost.'' The real reason I oppose turning numbers
Xinto characters and reading source files is that I am intrigued by the
Xquotational problems inherent in automatic programs, and these tricks
Xsidestep the issue.
X
X...
XDan Hoey
X1U23R11R'''1U23R11R'''
X
X
END_OF_apocrypha/hoey.hint
if test 1429 -ne `wc -c [apocrypha/hoey.hint`; then
echo shar: \"apocrypha/hoey.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/hoey.pre.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/hoey.pre.c\"
else
echo shar: Extracting \"apocrypha/hoey.pre.c\" \(281 characters\)
sed "s/^X//" ]apocrypha/hoey.pre.c [['END_OF_apocrypha/hoey.pre.c'
X
X/**/char q='"',*a="*//**/char q='%c',*a=%c%s%c*/};)b(stup;]d[b=]d-472[b)\
X--d(elihw;)q,a,q,q,2+a,b(ftnirps;)b(stup{)(niam;731=d tni;]572[b,",b[275]
X;int d=137;main(){puts(b);sprintf(b,a+2,q,q,a,q);while(d--)b[274-d]=b[d];
Xputs(b);}/*c%s%c%=a*,'c%'=q rahc/**//*"=a*,'"'=q rahc/**/
END_OF_apocrypha/hoey.pre.c
if test 281 -ne `wc -c [apocrypha/hoey.pre.c`; then
echo shar: \"apocrypha/hoey.pre.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/hoey2.pre.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/hoey2.pre.c\"
else
echo shar: Extracting \"apocrypha/hoey2.pre.c\" \(266 characters\)
sed "s/^X//" ]apocrypha/hoey2.pre.c [['END_OF_apocrypha/hoey2.pre.c'
X/**/char q='"',*a="*//**/char q='%c',*a=%c%s%c*/};)]d-062[b=]d[b(rahctup)\
X--d(elihw;)q,a,q,q,2+a,b(ftnirps{)(niam;162=d tni;]162[b,",b[261];int d=261
X;main(){sprintf(b,a+2,q,q,a,q);while(d--)putchar(b[d]=b[260-d]);}/*c%s%c%=a
X*,'c%'=q rahc/**//*"=a*,'"'=q rahc/**/
END_OF_apocrypha/hoey2.pre.c
if test 266 -ne `wc -c [apocrypha/hoey2.pre.c`; then
echo shar: \"apocrypha/hoey2.pre.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/ishai.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/ishai.c\"
else
echo shar: Extracting \"apocrypha/ishai.c\" \(1914 characters\)
sed "s/^X//" ]apocrypha/ishai.c [['END_OF_apocrypha/ishai.c'
X(*a);main(){char i,*s[]={"%c%s%c%c%c",
X"(*a);main(){char i,*s[]={",
X"%c%c%c%s%c%s%c%s%c%s%c/*%c%s",
X";printf(s[1]);for(i=0;i[=12;i++)printf(s[0],34,s[i],34,44,10);",
X"printf(s[2],34,34,125,s[3],10,s[4],10,s[5],10,s[6],10,41,s[7]);",
X"for(i=0;i[=12;i++)printf(s[0],39,s[i],39,44,10);",
X"printf(s[12],39,39,41,s[8],10,s[9],10,s[10],10,s[11],10,47,125);",
X"const q=#34;w=#39;n=#13#10;s:array[0..13] of string=(",
X";var i:integer;begin write(s[1]);for i:=0to 12do write(q,s[i],q,#44,n);",
X"write(#34#34#125,s[3],n,s[4],n,s[5],n,s[6],n,#47#42#41,s[7]);",
X"for i:=0to 12do write(w,s[i],w,#44,n); ",
X"write(#39#39#41,s[8],n,s[9],n,s[10],n,s[11],n,#123#42#47#125);end.",
X"%c%c%c%s%c%s%c%s%c%s%c{*%c%c",
X""};printf(s[1]);for(i=0;i[=12;i++)printf(s[0],34,s[i],34,44,10);
Xprintf(s[2],34,34,125,s[3],10,s[4],10,s[5],10,s[6],10,41,s[7]);
Xfor(i=0;i[=12;i++)printf(s[0],39,s[i],39,44,10);
Xprintf(s[12],39,39,41,s[8],10,s[9],10,s[10],10,s[11],10,47,125);
X/*)const q=#34;w=#39;n=#13#10;s:array[0..13] of string=('%c%s%c%c%c',
X'(*a);main(){char i,*s[]={',
X'%c%c%c%s%c%s%c%s%c%s%c/*%c%s',
X';printf(s[1]);for(i=0;i[=12;i++)printf(s[0],34,s[i],34,44,10);',
X'printf(s[2],34,34,125,s[3],10,s[4],10,s[5],10,s[6],10,41,s[7]);',
X'for(i=0;i[=12;i++)printf(s[0],39,s[i],39,44,10);',
X'printf(s[12],39,39,41,s[8],10,s[9],10,s[10],10,s[11],10,47,125);',
X'const q=#34;w=#39;n=#13#10;s:array[0..13] of string=(',
X';var i:integer;begin write(s[1]);for i:=0to 12do write(q,s[i],q,#44,n);',
X'write(#34#34#125,s[3],n,s[4],n,s[5],n,s[6],n,#47#42#41,s[7]);',
X'for i:=0to 12do write(w,s[i],w,#44,n); ',
X'write(#39#39#41,s[8],n,s[9],n,s[10],n,s[11],n,#123#42#47#125);end.',
X'%c%c%c%s%c%s%c%s%c%s%c{*%c%c',
X'');var i:integer;begin write(s[1]);for i:=0to 12do write(q,s[i],q,#44,n);
Xwrite(#34#34#125,s[3],n,s[4],n,s[5],n,s[6],n,#47#42#41,s[7]);
Xfor i:=0to 12do write(w,s[i],w,#44,n);
Xwrite(#39#39#41,s[8],n,s[9],n,s[10],n,s[11],n,#123#42#47#125);end.
X{*/}
END_OF_apocrypha/ishai.c
if test 1914 -ne `wc -c [apocrypha/ishai.c`; then
echo shar: \"apocrypha/ishai.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/ishai.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/ishai.hint\"
else
echo shar: Extracting \"apocrypha/ishai.hint\" \(595 characters\)
sed "s/^X//" ]apocrypha/ishai.hint [['END_OF_apocrypha/ishai.hint'
X
XIshai Ben-Aroya
Xishai@techunix.technion.ac.il
XTechnion, Israel Inst. of Technology
X(from rec.puzzles Dec. '91)
X
XMy comments:
XWorks under C, expect that it does not print the last newline.
XI do not have Turbo-Pascal; the Pascal portion seems to use
Xa nonstandard '#' operator and built-in string type, so I wouldn't
Ximagine it's very portable Pascal.
X
X
XAuthor's comments:
XHere is a self printing program that compiles under ANSI C and
Xunder TURBO-PASCAL. It is 1947 characters long.
X
XAny improvements on the size?
XHow about a self printing program that compiles under 3 languages?
X
X Ishai.
END_OF_apocrypha/ishai.hint
if test 595 -ne `wc -c [apocrypha/ishai.hint`; then
echo shar: \"apocrypha/ishai.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/jones.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/jones.c\"
else
echo shar: Extracting \"apocrypha/jones.c\" \(2075 characters\)
sed "s/^X//" ]apocrypha/jones.c [['END_OF_apocrypha/jones.c'
X/* This program prints its source. */
X
Xmain(argc, argv)
X char** argv;
X{
X char * dna =
X
X"/* This program prints its source. */\n\nmain(argc, argv)\n\
X char** argv;\n{\n char * dna =\n\nZ;\n\n\n express_stri\
Xng(dna);\n exit(0);\n}\n\n\n/* Express the string, substit\
Xuting a quotation of the string \n * for the character 'Z'.\
X Breaks the literal into lines of no\n * more than 60 char\
Xs.\n */\nexpress_string(str)\n char* str;\n{\n char* ptr \
X= str;\n char ch;\n int is_quoted = 0;\n\n while(ch = *p\
Xtr++)\n {\n\n if(ch == 'Z' && !is_quoted)\n\t{\n\t \
X int count = 1;\n\t char* ptr = str;\n\t char ch;\n\t pu\
Xtchar('\"');\n\t while(ch = *ptr++)\n\t {\n\t swit\
Xch(ch)\n\t {\n\t\tcase '\\n': printf(\"\\\\n\"); coun\
Xt +=2; break;\n\t\tcase '\\t': printf(\"\\\\t\"); count +=\
X2; break;\n\t\tcase '\\\\': printf(\"\\\\\\\\\"); count +=2\
X; break;\n\t\tcase '\"': printf(\"\\\\\\\"\"); count +=2; \
Xbreak;\n\t\tdefault: putchar(ch); count +=1; break;\n\t\
X }\n\t if(count ]= 59)\n\t\t{ printf(\"\\\\\\n\")\
X;\n\t\t count = 0;\n\t\t}\n\t }\n\t putchar('\"');\n\t\
X}\n\n else putchar(ch);\n is_quoted = ( ch == '\\\
X'');\n }\n}\n";
X
X
X express_string(dna);
X exit(0);
X}
X
X
X/* Express the string, substituting a quotation of the string
X * for the character 'Z'. Breaks the literal into lines of no
X * more than 60 chars.
X */
Xexpress_string(str)
X char* str;
X{
X char* ptr = str;
X char ch;
X int is_quoted = 0;
X
X while(ch = *ptr++)
X {
X
X if(ch == 'Z' && !is_quoted)
X {
X int count = 1;
X char* ptr = str;
X char ch;
X putchar('"');
X while(ch = *ptr++)
X {
X switch(ch)
X {
X case '\n': printf("\\n"); count +=2; break;
X case '\t': printf("\\t"); count +=2; break;
X case '\\': printf("\\\\"); count +=2; break;
X case '"': printf("\\\""); count +=2; break;
X default: putchar(ch); count +=1; break;
X }
X if(count ]= 59)
X { printf("\\\n");
X count = 0;
X }
X }
X putchar('"');
X }
X
X else putchar(ch);
X is_quoted = ( ch == '\'');
X }
X}
END_OF_apocrypha/jones.c
if test 2075 -ne `wc -c [apocrypha/jones.c`; then
echo shar: \"apocrypha/jones.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/jones.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/jones.hint\"
else
echo shar: Extracting \"apocrypha/jones.hint\" \(772 characters\)
sed "s/^X//" ]apocrypha/jones.hint [['END_OF_apocrypha/jones.hint'
X
XDave Jones
Xdjones@megatest.UUCP
X(Sept. '90 comp.lang.c)
X
XMy comments:
XYA self-printing program, better formatted than most.
X
X
XAuthor's comments:
XThere are lots of versions [self-rep programs] around. Most of them are
Xdependent on the text-code (ASCII or EBCDIC), which I think blows the
Xwhole deal. Such a program is a "C-and-ASCII" program, not a C program.
XBesides, the ones I have seen are not very readable.
X
XI wrote a machine-independent version a few years ago, just for the
Xheck of it. It bootstraps itself in a way that is both interesting and
Xinstructional, I think. Here 'tis. If you are interested in how it was
Xmade, send me a note, and I'll send you a shar of the bootstrap procedure.
X(I didn't write that insane string-constant by hand, I'll assure you.)
END_OF_apocrypha/jones.hint
if test 772 -ne `wc -c [apocrypha/jones.hint`; then
echo shar: \"apocrypha/jones.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/maarten.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/maarten.c\"
else
echo shar: Extracting \"apocrypha/maarten.c\" \(558 characters\)
sed "s/^X//" ]apocrypha/maarten.c [['END_OF_apocrypha/maarten.c'
X (* /*
XC ] /) 2] /dev/null & echo hello world!; exit
XC [[ 'CC'
XC
XC This file is a portable:
XC - (ANSI/KR) C source, about which lint(1) does not complain/warn;
XC - (ISO) Pascal source;
XC - (ANSI) Fortran-77 source;
XC - (POSIX/V7/BSD/System V) shell script.
XC
XC*/ foo()) { extern *bar; return ++bar; /*
XC*) program {*/} int (* /*
XC*) (output); begin writeln('hello world!') end. {
X print *, 'hello world!'
X end
XC*/ bar); main() { puts("hello world!"); return !foo(); /*
XCC
XC*/}
END_OF_apocrypha/maarten.c
if test 558 -ne `wc -c [apocrypha/maarten.c`; then
echo shar: \"apocrypha/maarten.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/maarten.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/maarten.hint\"
else
echo shar: Extracting \"apocrypha/maarten.hint\" \(204 characters\)
sed "s/^X//" ]apocrypha/maarten.hint [['END_OF_apocrypha/maarten.hint'
X
X
XMaarten Litmaath
Xuunet!cs.vu.nl!maart
Xmaart@cs.vu.nl
X(June '90 alt.folklore.computers)
X
XMy comments:
XA past IOCCC winner with a 4-language "hello, world" program.
X(C, Pascal, Fortran, and shell script)
END_OF_apocrypha/maarten.hint
if test 204 -ne `wc -c [apocrypha/maarten.hint`; then
echo shar: \"apocrypha/maarten.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/maze -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/maze\"
else
echo shar: Extracting \"apocrypha/maze\" \(481 characters\)
sed "s/^X//" ]apocrypha/maze [['END_OF_apocrypha/maze'
X._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
X| ._| . . ._| | |_._._. . ._|_._._._._. ._|_. ._|_._. ._| | . ._|_. | . ._._. |
X| ._|_| |_. | | | | ._._|_._|_._. . |_. | | | ._._| |_._._._| | ._. ._| . . |_|
X|_._._._. | ._|_. ._._._. | | ._. |_._. . | ._._| |_. | . ._._._. |_. | |_|_| |
X| | . |_._| . ._._._| ._._. ._._| | | |_| . | |_. . ._|_|_| ._._. |_._|_| . | |
X|_._|_._._._|_._._._|_|_._._._|_._|_._._._|_._._._|_._._._._|_._._._._._._|_._|
X|
END_OF_apocrypha/maze
if test 481 -ne `wc -c [apocrypha/maze`; then
echo shar: \"apocrypha/maze\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/mcfarlane.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/mcfarlane.hint\"
else
echo shar: Extracting \"apocrypha/mcfarlane.hint\" \(2098 characters\)
sed "s/^X//" ]apocrypha/mcfarlane.hint [['END_OF_apocrypha/mcfarlane.hint'
X
XGreg McFarlane
Xgregm@otc.otca.oz.au
XAustralia
X(alt.sources, Jan '91)
X
XMy comments:
XA set of vi macros to solve mazes. Goal ("X") is inserted in the first
Xgap along the bottom right edge.
X
XSee also:
Xhitz.hint (for original vi Turing machine, on which this is based)
Xtromp.c (for maze generator)
X
X
XAuthor's [edited for different distribution method] comments:
X
XTo get the correct ending message, ":set noterse" should be done. I have
Xmodified the macros below to do this. (This is probably not worth the effort.)
X
XAnyone who can't get the tromp.c file to compile, get a new compiler. I have
Xincluded a 5-line maze below for you.
X
XIf you can compile it but the maze comes out looking like a fence
Xand not a maze and you are using SysV or DOS replace the "27" on the
Xlast line by "11"
X
XIf you try to figure out how the macros work and wimp out, I will
Xsend a commented version of the macros to anyone who mails me.
X
XBy the way, I learnt about the power of vi macros from an item posted by
XDave Hitz to comp.sources.misc: v02i057: vi macros simulate a Turing Machine.
XI recommend this to anyone interested in such trivia.
X
XWhat follows is a repeat of my previous posting, with ":set noterse" added
Xto the macros, and with a maze to keep those with buggy compilers happy.
X
X=========================================================================
XA real working model. See it walk the maze in front of your very own eyes.
X
XTo prove that you can do anything in vi, I wrote a couple of macros that
Xallows vi to solve mazes.
X...
XJust follow this recipe and SEE FOR YOURSELF.
X 1. run "uudecode mvm.uuencode" to produce "maze.vi.macros"
X 2. run "tromp ] maze.out" and enter a small number, or use a
X copy of the file "maze" provided
X 3. edit "maze.out" with vi
X 4. include the macros with the vi command:
X :so maze.vi.macros
X 5. type the letter "g" (for "go") and watch vi solve the maze
X 6. when vi solves the maze, you will see why it lies
X
XTested on a sparc, a sun and a pyramid (although tromp.c will not compile
Xon the pyramid).
X
XAny donations should be in unmarked small denomination bills :^)=.
X
END_OF_apocrypha/mcfarlane.hint
if test 2098 -ne `wc -c [apocrypha/mcfarlane.hint`; then
echo shar: \"apocrypha/mcfarlane.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/mvm.uuencode -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/mvm.uuencode\"
else
echo shar: Extracting \"apocrypha/mvm.uuencode\" \(847 characters\)
sed "s/^X//" ]apocrypha/mvm.uuencode [['END_OF_apocrypha/mvm.uuencode'
Xbegin 664 maze.vi.macros
XM[V5T(')E;6%P"G-E="!N;VUA9VEC"G-E="!N;W1E[G-E"FUA["!G($E,"FUA
XM["!)($[_+@U],D=1;&UA1UE*]DIE2D1*2U P4V!A"FUA["!,(%%!;6%'3D(P
XM33!%0&T-=UA@84!M1U0D0B12,$TP14!M#69:8E-B6$=62C!(8&% [D!M50IM
XM87 @52!,"FUA["!1(")C]6P*;6%P($$@[D\*;6%P(%X@[E@*;6%P($X@0R]N
XM&PIM87 @0B B[W *;6%P($T@(FUY) IM87 @5"!#+W,;"FUA["!2(")N[ IM
XM87 @4R B[WEL"FUA["!8(")M]70@"FUA["!6(&%R&PIM87 @2B B8W *;6%P
XM($@@(G)Y) IM87 @1B B;GEL"FUA["!9(&]S02 @:R!%6B!S05\@;6T@0EH@
XM[T(;"FUA["!Z("1A(&UM($=:('-"("!L;"!!6B!S0BX@;&P@05H@[T,@(&H@
XM1UH@[T,N(&H@1UH-[T-?(&UM($1:('-$&PIM87 @92 D82!M;2!%6B!S1"X@
XM:&@@0UH@[T4N(&AH($-:('-%&PIM87 @1" D82!M;2!&6B!S1B @:R!%6B!S
XM1E\@;6T@05H-[T[N(&QL($%:('-'("!L;"!!6B!S1QL*;6%P($L@)&$@;6T@
XM2%H@[T@@(&H@1UH@[TA?(&UM($-:&PIM87 @4"!O;D$@:T8@;D(@;$8@;D,@
XM1R1*1B!N1"!H1B!N12!H1B!N1B!K1B!N1R!L1B!N2"!')$I&( U!&PIM87 @
X%12!D) IN
X
Xend
END_OF_apocrypha/mvm.uuencode
if test 847 -ne `wc -c [apocrypha/mvm.uuencode`; then
echo shar: \"apocrypha/mvm.uuencode\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/polyglot.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/polyglot.c\"
else
echo shar: Extracting \"apocrypha/polyglot.c\" \(5400 characters\)
sed "s/^X//" ]apocrypha/polyglot.c [['END_OF_apocrypha/polyglot.c'
X
X
X (*O/*_/
XCu #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex=
XCuG #%* *+Ex=
XCuG #%*------------------------------------------------------------------*+Ex=
XCuG #%* POLYGLOT - a program in seven languages 15 February 1991 *+Ex=
XCuG #%* *+Ex=
XCuG #%* Written by Kevin Bungard, Peter Lisle, and Chris Tham *+Ex=
XCuG #%* *+Ex=
XCuG #%* We have successfully run this program using the following: *+Ex=
XCuG #%* ANSI COBOL: MicroFocus COBOL85 (not COBOL74) *+Ex=
XCuG #%* ISO Pascal: Turbo Pascal (DOS & Mac), Unix PC, *+Ex=
XCuG #%* AIX VS Pascal *+Ex=
XCuG #%* ANSI Fortran: Unix f77, AIX VS Fortran *+Ex=
XCuG #%* ANSI C (lint free): Microsoft C, Unix CC, GCC, Turbo C++, *+Ex=
XCuG #%* Think C (Mac) *+Ex=
XCuG #%* PostScript: GoScript, HP/Adobe cartridge, *+Ex=
XCuG #%* Apple LaserWriter *+Ex=
XCuG #%* Shell script: gnu bash, sh (SysV, BSD, MKS), ksh *+Ex=
XCuG #%* 8086 machine language: MS-DOS 2.00, 3.03, 4.01, 5.00 beta *+Ex=
XCuG #%* VPix & DOS Merge (under unix) *+Ex=
XCuG #%* SoftPC (on a Mac), MKS shell *+Ex=
XCuG #%* *+Ex=
XCuG #%* Usage: *+Ex=
XCuG #%* 1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com] *+Ex=
XCuG #%* 2. Compile and/or run with appropriate compiler and *+Ex=
XCuG #%* operating system *+Ex=
XCuG #%* *+Ex=
XCuG #%* Notes: *+Ex=
XCuG #%* 1. We have attempted to use only standard language features. *+Ex=
XCuG #%* Without the -traditional flag gcc will issue a warning. *+Ex=
XCuG #%* *+Ex=
XCuG #%* 2. This text is a comment block in all seven languages. *+Ex=
XCuG #%* *+Ex=
XCuG #%* 3. When run as a .COM file with MS-DOS it makes certain *+Ex=
XCuG #%* (not unreasonable) assumptions about the contents of *+Ex=
XCuG #%* the registers. *+Ex=
XCuG #%* *+Ex=
XCuG #%* 4. When transfering from Unix to DOS make sure that a LF *+Ex=
XCuG #%* is correctly translated into a CR/LF. *+Ex=
XCuG #%* *+Ex=
XCuG #%* Please mail any comments, corrections or additions to *+Ex=
XCuG #%* peril@extro.ucc.su.oz.au *+Ex=
XCuG #%* *+Ex=
XCuG #%*------------------------------------------------------------------*QuZ=
XCuG #%* *+Ex=
XCuG #%*!Mx)ExQX4ZPZ4SP5n#5X!)Ex+ExPQXH,B+ExP[-9Z-9Z)GA(W@'UTTER_XYZZY'CPK*+
XCuG #(* *(
XC # */); /*(
XC # *) program polyglot (output); (*+
XC # identification division.
XC # program-id. polyglot.
XC #
XC # data division.
XC # procedure division.
XC #
XC # * ))cleartomark /Bookman-Demi findfont 36 scalefont setfont (
XC # * (
XC #
XC # * hello polyglots$
XC # main.
XC # perform
XC * ) 2]_$$; echo "hello polyglots"; rm _$$; exit
X print
XC stop run.
X -*, 'hello polyglots'
XC
XC print.
XC display "hello polyglots". (
XC */ int i; /*
XC */ main () { /*
XC */ i=printf ("hello polyglots\n"); O= &i; return *O; /*
XC *) (*
XC *) begin (*
XC *) writeln ('hello polyglots'); (*
XC *) (* )
XC * ) pop 60 360 (
XC * ) pop moveto (hello polyglots) show (
XC * ) pop showpage ((
XC *)
X end .(* )
XC)pop% program polyglot. *){*/}
END_OF_apocrypha/polyglot.c
if test 5400 -ne `wc -c [apocrypha/polyglot.c`; then
echo shar: \"apocrypha/polyglot.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/polyglot.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/polyglot.hint\"
else
echo shar: Extracting \"apocrypha/polyglot.hint\" \(296 characters\)
sed "s/^X//" ]apocrypha/polyglot.hint [['END_OF_apocrypha/polyglot.hint'
X
XKevin Bungard, Peter Lisle, and Chris Tham
Xperil@extro.ucc.su.oz.au
XAustralia
X(Feb. '91)
X
XMy comments:
XThe most amazing multilingual "hello, world!" program I've ever seen.
XDon't delete the first two blank lines! Works as a .COM file!? Zowie...
X
X
XAuthor's comments:
XSee comments in the source
END_OF_apocrypha/polyglot.hint
if test 296 -ne `wc -c [apocrypha/polyglot.hint`; then
echo shar: \"apocrypha/polyglot.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/tm.uuencode -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/tm.uuencode\"
else
echo shar: Extracting \"apocrypha/tm.uuencode\" \(983 characters\)
sed "s/^X//" ]apocrypha/tm.uuencode [['END_OF_apocrypha/tm.uuencode'
Xbegin 644 tm
XM;6%P"4,).B`*;6%P"4,).B`)5'5R:6YG($UA8VAI;F4@16UU;&%T:6]N($UA
XM8W)O[RX*;6%P"4,).B`*;6%P"4,).B`)5W)I='1E;B`Q.3@W(&)Y($1A=F4@
XM2&ET]BX@"FUA[`E#"3H@"4QE879E('1H:7,@;F]T:6-E('1O('-A=&ES9GD@
XM;7D@96=O+@IM87`)0PDZ(`IM87`)0PDZ"5550U`Z('MD96-V87@L=6-B=F%X
XM+&EH;G`T?2%D96-W[FPA;6EP[R%H:71Z(`D*;6%P"4,).@E$1$0Z(&AI='I`
XM-#`X+3DY,2TP,S0U"FUA[`E#"3H@"FUA[`E#"3H@"51O('5S92!T:&5S92!M
XM86-R;W,L('9I(&$@5$TL('-O=7)C92!T:&ES(&9I;&4L"FUA[`E#"3H@"6%N
XM9"!T]7!E(")G(B`H9F]R(&=O*2!F[F]M($530R!M;V1E+@IM87`)0PDZ(`IS
XM970)[F5M87`*;6%P"6[)]%,*;6%P"5,))W1L%':W=6=E@G[T!B9CIL;7-7
XM)W1K=VUT3V!S9CIL;7-70&)#8'-F.FQE,4=K=T580&)M;F!S[6!N46US[PIM
XM87`)[PE3"FUA[`E8"2)B60IM87`)&`DB8GDD"FUA[`E7"2)B]70Z"FUA[`EE
XM"2)B]71]"FUA[`EW"2)B4`IM87`)4@DG="MM=`IM87`)3`DG="UM=`IM87`)
XM3@DG=&UT"FUA[`E%"5YI+UY;*B!=&PIM87`)0PE]:'(J"FUA[`EC"5YH(&P*
XM;6%P"5$)7FAR*@IM87`)[0D_7"H-7G(@;`IM87`)5@E)+WL;"FUA[`EV"4$Z
XM&PIM87`)3PE]:2`;"FUA[`EK"19\1`IM87`)]`DZ)7,O7B\@+PTQ1R]](",C
X8(R,D+PUM=$,Q1R]](%-405)4+PUM[U$*
X`
Xend
END_OF_apocrypha/tm.uuencode
if test 983 -ne `wc -c [apocrypha/tm.uuencode`; then
echo shar: \"apocrypha/tm.uuencode\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/tromp.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/tromp.c\"
else
echo shar: Extracting \"apocrypha/tromp.c\" \(545 characters\)
sed "s/^X//" ]apocrypha/tromp.c [['END_OF_apocrypha/tromp.c'
X/*
XRun this C-program and enter a number. Ain't that amazing ?
XJohn Tromp (tromp@piring.cwi.nl)
X*/
Xchar*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C);
X-- E; J[ E] =T
X[E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|"
X) , A = 39 ,C --
X) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C
X& A == T[ A]
X|6[[27[rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];}
END_OF_apocrypha/tromp.c
if test 545 -ne `wc -c [apocrypha/tromp.c`; then
echo shar: \"apocrypha/tromp.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f apocrypha/tromp.hint -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"apocrypha/tromp.hint\"
else
echo shar: Extracting \"apocrypha/tromp.hint\" \(533 characters\)
sed "s/^X//" ]apocrypha/tromp.hint [['END_OF_apocrypha/tromp.hint'
X
X
XJohn Tromp
Xtromp@piring.cwi.nl
X
XMy comments:
XA mazelike maze-generating program that also spells out "maze" in its code.
XTromp later submitted a winning Tetris clone to the IOCCC.
X
XNote: the "6[[27" in the last line should be changed to "6[[11" if
Xyou have 16-bit integers. If it doesn't produce a good maze, try the other
Xvalue. Needs rand(). An entry in the 1988 IOCCC that didn't win.
X
XSee also:
Xmcfarlane.hint (for a vi Turing machine that solves mazes produced by tromp.c)
Xhitz.hint (for original vi Turing-machine macros)
END_OF_apocrypha/tromp.hint
if test 533 -ne `wc -c [apocrypha/tromp.hint`; then
echo shar: \"apocrypha/tromp.hint\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0