Merge pull request #47 from xexyl/1990
This commit is contained in:
17 files changed
+420
-347
No files matched your search
+35
-35
@@ -18,56 +18,56 @@
|
||||
|
||||
### To run
|
||||
|
||||
echo 4 | baruch
|
||||
echo 7 | baruch
|
||||
echo 4 | ./baruch
|
||||
echo 7 | ./baruch
|
||||
|
||||
## Judges' comments
|
||||
|
||||
This program reads an integer between 4 and 99 from the stdin.
|
||||
This program reads an integer between 4 and 99 from the stdin.
|
||||
|
||||
NOTE: The original program did not have a newline at the end of
|
||||
the file. We added a final newline to the file to make
|
||||
unpacking easy.
|
||||
NOTE: The original program did not have a newline at the end of the file. We
|
||||
added a final newline to the file to make unpacking easy.
|
||||
|
||||
## Author's comments
|
||||
## Authors' comments
|
||||
|
||||
The goal of this work was to write a program that solves the
|
||||
classic n-queen problem, with a board size of up to 99x99, while
|
||||
keeping the program as short as possible.
|
||||
The goal of this work was to write a program that solves the
|
||||
classic n-queen problem, with a board size of up to 99x99, while
|
||||
keeping the program as short as possible.
|
||||
|
||||
The program finds all possibilities to place N chess queens on
|
||||
a NxN chess board so that no queen is in range of any other queen
|
||||
(not in the same column row or diagonal). For each solution the
|
||||
chess board and the place of the queens is printed to stdout.
|
||||
The program finds all possibilities to place N chess queens on
|
||||
a NxN chess board so that no queen is in range of any other queen
|
||||
(not in the same column row or diagonal). For each solution the
|
||||
chess board and the place of the queens is printed to stdout.
|
||||
|
||||
|
||||
This program is about as simple and as readable as possible.
|
||||
To make things even more simple we used a very limited subset of C:
|
||||
This program is about as simple and as readable as possible.
|
||||
To make things even more simple we used a very limited subset of C:
|
||||
|
||||
No pre-processor statements
|
||||
Only one, harmless, 'for' statement
|
||||
No ifs
|
||||
No breaks
|
||||
No cases
|
||||
No functions
|
||||
No gotos
|
||||
No structures
|
||||
No pre-processor statements
|
||||
Only one, harmless, 'for' statement
|
||||
No ifs
|
||||
No breaks
|
||||
No cases
|
||||
No functions
|
||||
No gotos
|
||||
No structures
|
||||
|
||||
In short, it contains no C language that might confuse the
|
||||
innocent reader. :-)
|
||||
In short, it contains no C language that might confuse the
|
||||
innocent reader. :-)
|
||||
|
||||
|
||||
This program demonstrates the claim that in C, any program
|
||||
can be written using a single 'for' statement, as long as it is
|
||||
long enough..
|
||||
This program demonstrates the claim that in C, any program
|
||||
can be written using a single 'for' statement, as long as it is
|
||||
long enough..
|
||||
|
||||
The authors further note:
|
||||
The authors' further note:
|
||||
|
||||
For PC users:
|
||||
In order to compile the program under Turbo-C or MSC, 'int '
|
||||
should be inserted at the beginning of the program.
|
||||
For better looking results it is recommended to replace the " #Q"
|
||||
string with " \261\2".
|
||||
For PC users:
|
||||
|
||||
In order to compile the program under Turbo-C or MSC, 'int '
|
||||
should be inserted at the beginning of the program.
|
||||
For better looking results it is recommended to replace the " #Q"
|
||||
string with " \261\2".
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
|
||||
+23
-12
@@ -14,6 +14,17 @@
|
||||
|
||||
./cmills [starting_cash]
|
||||
|
||||
NOTE: we used a patch from Yusuke Endoh to get this to work in modern systems
|
||||
(it resulted in a bus error otherwise). Thank you Yusuke for your assistance!
|
||||
|
||||
### Try:
|
||||
|
||||
./cmills 5000
|
||||
|
||||
|
||||
NOTE: this program uses `gets()` so you will likely get a warning under modern
|
||||
systems.
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Compile notes:
|
||||
@@ -27,20 +38,20 @@
|
||||
|
||||
## Author's comments
|
||||
|
||||
This is a blackjack program. It does splits, doubling down,
|
||||
insurance, etc.
|
||||
This is a blackjack program. It does splits, doubling down,
|
||||
insurance, etc.
|
||||
|
||||
As best I can figure, it should be ANSI-compliant, as well as
|
||||
portable to BSD & sysV (as well as the irritating compiler I
|
||||
was using which assumes x=*p++ means x*=p++!). It is
|
||||
reasonably robust in its error handling---it won't let you
|
||||
split, double, etc. unless you actually have the cash, etc. To
|
||||
terminate the program, hit EOF or type 0 or a negative number
|
||||
for you wager.
|
||||
As best I can figure, it should be ANSI-compliant, as well as
|
||||
portable to BSD & sysV (as well as the irritating compiler I
|
||||
was using which assumes `x=*p++` means `x*=p++`!). It is
|
||||
reasonably robust in its error handling---it won't let you
|
||||
split, double, etc. unless you actually have the cash, etc. To
|
||||
terminate the program, hit EOF or type 0 or a negative number
|
||||
for you wager.
|
||||
|
||||
The way it deals with splits is particularly cool (IMHO). You
|
||||
can split many times, and it will show all hands as they are
|
||||
played.
|
||||
The way it deals with splits is particularly cool (IMHO). You
|
||||
can split many times, and it will show all hands as they are
|
||||
played.
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define H(v,g)v=h(v,*g++= *r++),*g=0;
|
||||
#define B(n)b(l,n),(V)printf(l
|
||||
V
|
||||
exit();char*g,c[M],d[N],q[N],p[N],*e,*r=d+N,l[M],*t="??",*k,*m="DEATHISDSev2oinpohae3ttsluuln4a?uibfe 5l\0rtlfrb6 ?a?el:e7$!n\0?e t8%ccp\0.%s9deelc.s T.@?-t.\t<J /\0=a\nP=Q Sex \0l KW Sin a$\0ane-lay% ge#-slediefuk ar r$via-:o ?+}:r? n \0:) ee%lone 1-esy666!-~v\n.!^`'~@#\0\np~===:=q";b(o,n)char*o;{for(k=n+m;*o++=*k;k+=9);}int
|
||||
exit();char*g,c[M],d[N],q[N],p[N],*e,*r=d+N,l[M],t[]="??",*k,*m="DEATHISDSev2oinpohae3ttsluuln4a?uibfe 5l\0rtlfrb6 ?a?el:e7$!n\0?e t8%ccp\0.%s9deelc.s T.@?-t.\t<J /\0=a\nP=Q Sex \0l KW Sin a$\0ane-lay% ge#-slediefuk ar r$via-:o ?+}:r? n \0:) ee%lone 1-esy666!-~v\n.!^`'~@#\0\np~===:=q";b(o,n)char*o;{for(k=n+m;*o++=*k;k+=9);}int
|
||||
y=M*2,v,x,s,f,j,o;u(s){B(s));if(!gets(l))exit(0);return(o=
|
||||
*l)=='y'||o=='Y'||o!='n'&&o!='N'&&u(s);}h(v,m){for(k=c;*k!='J';)if(m==*k++)break;m=k-c;if(v<0)W(v=m-v)
|
||||
if(m==1)W(v+=11)
|
||||
|
||||
@@ -184,7 +184,6 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: This entry might not compile when using modern compilers."
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
|
||||
+39
-32
@@ -11,6 +11,9 @@
|
||||
make all
|
||||
|
||||
|
||||
Modern compilers could not compile this entry but Yusuke Endoh supplied a patch
|
||||
which lets it compile. Thank you Yusuke!
|
||||
|
||||
### To run
|
||||
|
||||
./dds
|
||||
@@ -19,31 +22,32 @@
|
||||
NOTE: this entry uses `gets()` so you might get a warning when compiling and
|
||||
running this entry.
|
||||
|
||||
### Try:
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Give the following lines as input:
|
||||
Give the following lines as input:
|
||||
|
||||
OLD LANDER.BAS
|
||||
RUN
|
||||
|
||||
Be sure not to run out of fuel!
|
||||
NOTE: this is case sensitive.
|
||||
|
||||
|
||||
Modern compilers could not compile this entry but Yusuke Endoh supplied a patch
|
||||
which lets it compile. Thank you Yusuke!
|
||||
## Judges' comments
|
||||
|
||||
|
||||
Be sure not to run out of fuel!
|
||||
|
||||
|
||||
## Author's comments
|
||||
|
||||
This is the DDS-BASIC Interpreter (Version 1.00).
|
||||
This is the DDS-BASIC Interpreter (Version 1.00).
|
||||
|
||||
Immediate commands:
|
||||
Immediate commands:
|
||||
|
||||
RUN LIST NEW OLD filename
|
||||
BYE SAVE filename
|
||||
|
||||
Program commands:
|
||||
Program commands:
|
||||
|
||||
variable names a to z variables initialized to 0 on RUN
|
||||
FOR var = exp TO exp NEXT variable
|
||||
@@ -53,7 +57,7 @@ running this entry.
|
||||
PRINT exp var = exp
|
||||
REM any text END
|
||||
|
||||
Expressions (ranked by precedence):
|
||||
Expressions (ranked by precedence):
|
||||
|
||||
Bracketed expressions
|
||||
number (leading 0 for octal, 0x for hex, else decimal), variable
|
||||
@@ -66,20 +70,21 @@ running this entry.
|
||||
(* and + are also used for boolean AND and boolean OR)
|
||||
Boolean expressions evaluate to 0 for false and 1 for true
|
||||
|
||||
Editing:
|
||||
Editing:
|
||||
|
||||
- Line editor using line re-entry.
|
||||
- A line number with nothing following it, deletes the line.
|
||||
- Line editor using line re-entry.
|
||||
- A line number with nothing following it, deletes the line.
|
||||
|
||||
Input format:
|
||||
Input format:
|
||||
|
||||
- Free format positioning of tokens on the line.
|
||||
- No space is allowed before the line number.
|
||||
- Exactly one space is needed between the OLD or SAVE command and
|
||||
the filename.
|
||||
- ALL INPUT MUST BE UPPERCASE.
|
||||
- Free format positioning of tokens on the line.
|
||||
- No space is allowed before the line number.
|
||||
- Exactly one space is needed between the OLD or SAVE command and
|
||||
the filename.
|
||||
- ALL INPUT MUST BE UPPERCASE.
|
||||
|
||||
Limits:
|
||||
|
||||
Limits:
|
||||
|
||||
Line numbers 1-10000
|
||||
Line length 999 characters
|
||||
@@ -89,26 +94,28 @@ running this entry.
|
||||
Expressions -32768 - 32767 for 16 bit machines,
|
||||
-2147483648 - 2147483647 for 32 bit machines
|
||||
|
||||
Error checking / error reports:
|
||||
Error checking / error reports:
|
||||
|
||||
No error checking is performed.
|
||||
The message `core dumped' signifies a syntax or semantic error.
|
||||
|
||||
Hosting Environment:
|
||||
No error checking is performed.
|
||||
It might dump core if a syntax or semantic error is encountered.
|
||||
|
||||
|
||||
Hosting Environment:
|
||||
|
||||
ANSI C, traditional K&R C or OSF ANDF
|
||||
ASCII or EBCIDIC character set
|
||||
48K bytes memory
|
||||
|
||||
The Speed of DDS-BASIC Interpreter (Version 1.00). relative to
|
||||
Microsoft Advanced BASIC 3.31 is Approximately 60%.
|
||||
The Speed of DDS-BASIC Interpreter (Version 1.00). relative to
|
||||
Microsoft Advanced BASIC 3.31 is Approximately 60%.
|
||||
|
||||
The code size could be further reduced by doing ugly things like
|
||||
not declaring the return type of functions, not freeing memory,
|
||||
#defining define, and joining lines. In its present 1536 character
|
||||
form the program is reasonably portable (it may fail to run in a
|
||||
tagged object architecture) and nicely formatted (it fits in an
|
||||
80*25 screen).
|
||||
The code size could be further reduced by doing ugly things like
|
||||
not declaring the return type of functions, not freeing memory,
|
||||
#defining define, and joining lines. In its present 1536 character
|
||||
form the program is reasonably portable (it may fail to run in a
|
||||
tagged object architecture) and nicely formatted (it fits in an
|
||||
80*25 screen).
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
|
||||
+14
-11
@@ -10,34 +10,37 @@
|
||||
|
||||
make all
|
||||
|
||||
NOTE: This entry might not compile when using modern compilers.
|
||||
|
||||
### To run
|
||||
### To run:
|
||||
|
||||
echo foo bar | ./dg
|
||||
|
||||
### Try:
|
||||
|
||||
echo "to C or not to C" | ./dg
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Some C preprocessors got confused about single quotes in certain cases.
|
||||
In particular, the following source line:
|
||||
Some C preprocessors got confused about single quotes in certain cases.
|
||||
In particular, the following source line:
|
||||
|
||||
b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
|
||||
|
||||
sometimes has to be changed to:
|
||||
sometimes has to be changed to:
|
||||
|
||||
b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
|
||||
|
||||
if the C preprocessor botches single quotes in cpp expansions, which we have
|
||||
done for the wider audience.
|
||||
if the C preprocessor botches single quotes in cpp expansions, which we have
|
||||
done for the wider audience.
|
||||
|
||||
|
||||
## Author's comments
|
||||
|
||||
If my preprocessor could hack it, I could write this as one single
|
||||
line rather than 4, but when I do that I get a complaint "defines
|
||||
nested too deeply".
|
||||
If my preprocessor could hack it, I could write this as one single
|
||||
line rather than 4, but when I do that I get a complaint "defines
|
||||
nested too deeply".
|
||||
|
||||
Spoiler: (rot13 to read)
|
||||
Spoiler: (rot13 to read)
|
||||
|
||||
Guvf vf nabgure ebg13 wbo (oryvrir vg be abg) - gur #qrsvarf ner n
|
||||
abiry jnl bs nqqvat gbxraf: '#qrsvar o12(k) 12 k' zrnaf gung ng
|
||||
|
||||
+118
-116
@@ -21,38 +21,44 @@
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
make all
|
||||
|
||||
### To run
|
||||
NOTE: as `btoa` is not common we used a ruby script from Yusuke Endoh. Thank you
|
||||
Yusuke for your implementation of `btoa`!
|
||||
|
||||
echo "Quartz glyph jocks vend, fix, BMW." | ./compress | ./btoa | ./jaw
|
||||
### Try:
|
||||
|
||||
## Judges' comments
|
||||
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
|
||||
|
||||
NOTE: part of this entry does not work under macOS.
|
||||
|
||||
|
||||
The program, in its base form, implements two useful utilities:
|
||||
## Judges' comments:
|
||||
|
||||
|
||||
The program, in its base form, implements two useful utilities:
|
||||
|
||||
atob - ascii to binary conversion
|
||||
zcat - decompression filter
|
||||
|
||||
To test the official C entry, one might try:
|
||||
To test the official C entry, one might try:
|
||||
|
||||
echo "Quartz glyph jocks vend, fix, BMW." | compress | btoa | jaw
|
||||
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
|
||||
|
||||
which should apply the identity transformation to a minimal
|
||||
holoalphabetic sentence.
|
||||
which should apply the identity transformation to a minimal
|
||||
holoalphabetic sentence.
|
||||
|
||||
Included with this entry is a shell script (with comments edited down
|
||||
to reduce it to 1530 bytes) which implements the complete
|
||||
shark utility. The script, shark.sh, contains a 'jaw.c' embedded
|
||||
within it!
|
||||
Included with this entry is a shell script (with comments edited down
|
||||
to reduce it to 1530 bytes) which implements the complete
|
||||
shark utility. The script, shark.sh, contains a 'jaw.c' embedded
|
||||
within it!
|
||||
|
||||
The sender must have 'compress' and 'btoa'. To send, try:
|
||||
The sender must have 'compress' and 'btoa'. To send, try:
|
||||
|
||||
sh shark.sh jaw.* > receive
|
||||
|
||||
The resulting file, 'receive', unpacks the input files
|
||||
even if the receiver lacks 'uncompress' and 'atob':
|
||||
The resulting file, 'receive', unpacks the input files
|
||||
even if the receiver lacks 'uncompress' and 'btoa':
|
||||
|
||||
mkdir test
|
||||
cd test
|
||||
@@ -60,71 +66,68 @@
|
||||
cmp ../jaw.c jaw.c
|
||||
cmp ../jaw.hint jaw.hint
|
||||
|
||||
## Author's comments
|
||||
## Authors' comments:
|
||||
|
||||
ABSTRACT
|
||||
ABSTRACT
|
||||
|
||||
Minimal, Universal File Bundling
|
||||
(or, Functional Obfuscation in a Self-Decoding Unix Shell Archive)
|
||||
Minimal, Universal File Bundling
|
||||
(or, Functional Obfuscation in a Self-Decoding Unix Shell Archive)
|
||||
|
||||
James A. Woods
|
||||
Universities Space Research Association
|
||||
NASA Ames Research Center
|
||||
James A. Woods
|
||||
Universities Space Research Association
|
||||
NASA Ames Research Center
|
||||
|
||||
|
||||
"Use an algorithm, go to jail."
|
||||
"Use an algorithm, go to jail."
|
||||
[anon., circa 1988, pre-Morris worm era]
|
||||
|
||||
|
||||
Myriad formats have been proposed for network-mailable
|
||||
data. A major difficulty undermining the popularity of most
|
||||
file/message bundlers is that the sender assumes prior
|
||||
installation of the computational dual of such bundling
|
||||
software by the receiver. Command shell archives alleviate
|
||||
this problem somewhat, but still require standardization for
|
||||
the function of data compression and mail-transparency
|
||||
encoding. On Unix, these coding format quandaries are over-
|
||||
come by planting a novel Trojan Horse in the archive header
|
||||
to perform negotiationless decoding.
|
||||
Myriad formats have been proposed for network-mailable
|
||||
data. A major difficulty undermining the popularity of most
|
||||
file/message bundlers is that the sender assumes prior
|
||||
installation of the computational dual of such bundling
|
||||
software by the receiver. Command shell archives alleviate
|
||||
this problem somewhat, but still require standardization for
|
||||
the function of data compression and mail-transparency
|
||||
encoding. On Unix, these coding format quandaries are over-
|
||||
come by planting a novel Trojan Horse in the archive header
|
||||
to perform negotiation-less decoding.
|
||||
|
||||
Specifically, we outline the development of an extraor-
|
||||
dinarily compact portable (un)bundler to (dis)assemble
|
||||
data-compressed, binary-to-ASCII-converted, length-split,
|
||||
and checksummed directory structures using standard Unix
|
||||
tools. Miniature versions of counterparts to a Lempel-Ziv
|
||||
coder ('compress' or 'squeeze') and an efficient bit packet-
|
||||
izer ('btoa') are compiled on-the-fly at mail destination
|
||||
sites where they may not already exist. These are written
|
||||
in purposefully obfuscated-C to accompany similarly-shrunk
|
||||
shell command glue. This resulting shell archiver is dubbed
|
||||
'shark'.
|
||||
Specifically, we outline the development of an extraordinarily compact
|
||||
portable (un)bundler to (dis)assemble data-compressed,
|
||||
binary-to-ASCII-converted, length-split, and checksummed directory structures
|
||||
using standard Unix tools. Miniature versions of counterparts to a Lempel-Ziv
|
||||
coder ('compress' or 'squeeze') and an efficient bit packet- izer ('btoa') are
|
||||
compiled on-the-fly at mail destination sites where they may not already
|
||||
exist. These are written in purposefully obfuscated-C to accompany
|
||||
similarly-shrunk shell command glue. This resulting shell archiver is dubbed
|
||||
'shark'.
|
||||
|
||||
'Shark' procedure overhead consumes as few as three
|
||||
dozen shell lines (or ~1100 bytes), commensurate with the
|
||||
size of many Internet mail headers; it amortizes favorably
|
||||
with message size. 'Shark' is portable across Unix vari-
|
||||
ants, while the underlying technique is inherently general-
|
||||
izable to other encoding schemes.
|
||||
'Shark' procedure overhead consumes as few as three dozen shell lines (or
|
||||
~1100 bytes), commensurate with the size of many Internet mail headers; it
|
||||
amortizes favorably with message size. 'Shark' is portable across Unix
|
||||
variants, while the underlying technique is inherently generalizable to other
|
||||
encoding schemes.
|
||||
|
||||
In the function-theoretic sense of minimal
|
||||
Chaitin/Kolmogorov complexity, and within a modified Shannon
|
||||
model of communication, the 'shark' effort aims to construct
|
||||
a "shortest program" for source decoding in the Turing-
|
||||
universal Unix environment.
|
||||
In the function-theoretic sense of minimal
|
||||
Chaitin/Kolmogorov complexity, and within a modified Shannon
|
||||
model of communication, the 'shark' effort aims to construct
|
||||
a "shortest program" for source decoding in the Turing-
|
||||
universal Unix environment.
|
||||
|
||||
----------------------------------------------
|
||||
----------------------------------------------
|
||||
|
||||
Oh, the shark has pretty teeth, dear--
|
||||
And he shows them pearly white
|
||||
Just a jackknife has Macheath, dear--
|
||||
And he keeps it out of sight.
|
||||
Oh, the shark has pretty teeth, dear--
|
||||
And he shows them pearly white
|
||||
Just a jackknife has Macheath, dear--
|
||||
And he keeps it out of sight.
|
||||
|
||||
[Bertolt Brecht, Threepenny Opera]
|
||||
|
||||
----------------------------------------------
|
||||
----------------------------------------------
|
||||
|
||||
We have ported this program to a wide variety of systems. Among
|
||||
these are:
|
||||
We have ported this program to a wide variety of systems. Among
|
||||
these are:
|
||||
|
||||
SunOS 4.1 / Sun Sparcstation 1 (using both 'cc' and 'gcc 1.37.1')
|
||||
SunOS 4.0.3 / Sun 3
|
||||
@@ -137,92 +140,91 @@
|
||||
Dynix / Sequent Balance ('cc' for Natl. Semi. base + 'gcc 1.36')
|
||||
Unicos / Cray 2
|
||||
|
||||
We (the authors) feel this program is obfuscated for the
|
||||
following reasons:
|
||||
We (the authors) feel this program is obfuscated for the
|
||||
following reasons:
|
||||
|
||||
(0) This is one of the few programs you'll see WHOSE VERY UTILITY
|
||||
DEPENDS ON ITS OBFUSCATION!
|
||||
|
||||
(1) The contest entry may be used to send its wonderful self to
|
||||
anyone in the Unix world! Virus writers need not apply...
|
||||
0. This is one of the few programs you'll see WHOSE VERY UTILITY DEPENDS ON ITS
|
||||
OBFUSCATION!
|
||||
|
||||
(2) The basic idea is twisted enough to be patentable, but is,
|
||||
out of the kindness of our hearts (as well as to maintain
|
||||
eligibility for the large IOCCC prize fund), dedicated to
|
||||
the public domain. Claude Shannon, meet Alan Turing.
|
||||
1. The contest entry may be used to send its wonderful self to anyone in the
|
||||
Unix world! Virus writers need not apply...
|
||||
|
||||
(3) Meta-obfuscation is via obfuscated description (see ABSTRACT).
|
||||
2. The basic idea is twisted enough to be patentable, but is, out of the
|
||||
kindness of our hearts (as well as to maintain eligibility for the large IOCCC
|
||||
prize fund), dedicated to the public domain. Claude Shannon, meet Alan Turing.
|
||||
|
||||
(4) "Literary" allusion. Production code contains a reference to
|
||||
self-reference, preserved at amazing cost for sheer perversity.
|
||||
3. Meta-obfuscation is via obfuscated description (see ABSTRACT).
|
||||
|
||||
(5) Many, many micro obfuscations below, honed over three years
|
||||
time, in shell as well as C. Ask about the 'tar' pit escape,
|
||||
the argv[0] flip, Paul's &4294967295 portability hack, the
|
||||
"void where prohibited by flaw" fix, the scanf() spacesaver,
|
||||
shift shenanigans, signal madness, exit()ing stage left, and
|
||||
source-to-source transformations galore.
|
||||
4. "Literary" allusion. Production code contains a reference to self-reference,
|
||||
preserved at amazing cost for sheer perversity.
|
||||
|
||||
For extra credit:
|
||||
5. Many, many micro obfuscations below, honed over three years time, in shell as
|
||||
well as C. Ask about the 'tar' pit escape, the argv[0] flip, Paul's &4294967295
|
||||
portability hack, the "void where prohibited by flaw" fix, the scanf()
|
||||
spacesaver, shift shenanigans, signal madness, exit()ing stage left, and
|
||||
source-to-source transformations galore.
|
||||
|
||||
Construct 'sharkmail', to auto-split sharkives into mailable
|
||||
segments and mail them. Here's a simple one, which could be
|
||||
extended to enable auto-reassembly with one shell cmd at the
|
||||
far end.
|
||||
For extra credit:
|
||||
|
||||
------------------------ cut here for sharkmail -----------------------
|
||||
#!/bin/sh
|
||||
m=$1; shift
|
||||
shark $* | split -800 - /tmp/shark$$
|
||||
n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'`
|
||||
p=0
|
||||
for f in `ls /tmp/shark$$*`
|
||||
do
|
||||
p=`expr $p + 1`
|
||||
mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
|
||||
done
|
||||
rm /tmp/shark$$*
|
||||
------------------------ end of sharkmail -----------------------------
|
||||
Construct 'sharkmail', to auto-split sharkives into mailable
|
||||
segments and mail them. Here's a simple one, which could be
|
||||
extended to enable auto-reassembly with one shell cmd at the
|
||||
far end.
|
||||
|
||||
------------------------ cut here for sharkmail -----------------------
|
||||
#!/bin/sh
|
||||
m=$1; shift
|
||||
shark $* | split -800 - /tmp/shark$$
|
||||
n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'`
|
||||
p=0
|
||||
for f in `ls /tmp/shark$$*`
|
||||
do
|
||||
p=`expr $p + 1`
|
||||
mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
|
||||
done
|
||||
rm /tmp/shark$$*
|
||||
------------------------ end of sharkmail -----------------------------
|
||||
|
||||
|
||||
Shark history:
|
||||
|
||||
May 1987: Karl Fox introduces 1023-byte zcat.c to USENET.
|
||||
May 1987: Karl Fox introduces 1023-byte zcat.c to USENET.
|
||||
It's too late for the 4th IOCCC.
|
||||
|
||||
May 21, 1987: James A. Woods extends idea to construct self
|
||||
May 21, 1987: James A. Woods extends idea to construct self
|
||||
decompressing shar Trojan horse, utilizing 'cc', 'shar',
|
||||
'zcat', & 'atob'; size: 2303 bytes.
|
||||
'zcat', & 'btoa'; size: 2303 bytes.
|
||||
|
||||
May 23, 1987: 'jaw' trims 250 bytes without much thought.
|
||||
May 23, 1987: 'jaw' trims 250 bytes without much thought.
|
||||
|
||||
June 2, 1987: 52 lines of shell, 1991 bytes, now made with 'tar',
|
||||
June 2, 1987: 52 lines of shell, 1991 bytes, now made with 'tar',
|
||||
short-circuit C-compile at far end, dual-use main.c,
|
||||
portability mods. (jaw)
|
||||
|
||||
Mar-May 1988: abortive run at 5th IOCCC.
|
||||
jaw.c - 1529 bytes. compile line: 152 bytes.
|
||||
Mar-May 1988: abortive run at 5th IOCCC.
|
||||
jaw.c - 1529 bytes. compile line: 152 bytes.
|
||||
generated funny code with execvp() to invoke shell.
|
||||
|
||||
Aug 29, 1988: production version, now at 1830 bytes.
|
||||
Aug 29, 1988: production version, now at 1830 bytes.
|
||||
|
||||
Jan 1990: Paul Eggert does tour-de-force shark re-engineering.
|
||||
Jan 1990: Paul Eggert does tour-de-force shark re-engineering.
|
||||
|
||||
May 24, 1990: collaboration yields 999-byte jaw.c core (see above)
|
||||
May 24, 1990: collaboration yields 999-byte jaw.c core (see above)
|
||||
and 1530-byte production shell code (w/comments).
|
||||
Eggert comes through with lion's share of improvements.
|
||||
7th IOCCC code now faster than the atob/zcat it replaces.
|
||||
7th IOCCC code now faster than the btoa/zcat it replaces.
|
||||
|
||||
May 1990: 'jaw' develops experimental replacement using
|
||||
May 1990: 'jaw' develops experimental replacement using
|
||||
Dan Bernstein's high-compression 'squeeze'.
|
||||
|
||||
|
||||
To which we add:
|
||||
|
||||
June 1990: 'shark' wins the IOCCC, finally! :-)
|
||||
June 1990: 'shark' wins the IOCCC, finally! :-)
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
granted provided this this copyright and notice are included in its entirety
|
||||
and remains unaltered. All other uses must receive prior permission in writing
|
||||
and remains unaltered. All other uses must receive prior permission in writing
|
||||
from both Landon Curt Noll and Larry Bassel.
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env ruby
|
||||
puts "xbtoa Begin"
|
||||
data = $<.read
|
||||
n, e, s, r = data.bytesize, 0, 0, 0
|
||||
(-n % 4).times { data << 0 }
|
||||
data.bytes do |b|
|
||||
e, s, r = e ^ b, (s + b + 1) & 0xffffffff, (r * 2 + r[31] + b) & 0xffffffff
|
||||
end
|
||||
data.unpack("N*").flat_map do |v|
|
||||
v == 0 ? [?z.ord] : (0..4).map {|i| v / 85**(4 - i) % 85 + 33 }
|
||||
end.pack("C*").scan(/.{1,78}/) { puts $& }
|
||||
puts "xbtoa End N %d %x E %x S %x R %x" % [n, n, e, s, r]
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done
|
||||
(cat&&tar cbf 1 - "$@"|compress|btoa&&echo w)<<\Z
|
||||
(cat&&tar cbf 1 - "$@"|compress|./btoa&&echo w)<<\Z
|
||||
#!/bin/sh
|
||||
#
|
||||
# GENTLE READER -- write this message to file [no headers!]; run "sh file".
|
||||
@@ -13,7 +13,7 @@ PATH=$PATH:. a=atob m=unshark z=zcat
|
||||
r="rm -f $a $m* $z" v="cc -o $z $m.c"
|
||||
trap "$r;exit 1" 1 2 13 15
|
||||
echo decoding...
|
||||
(:|compress|btoa|$a|$z)2>$m>&2||(sed '1,9s/./#define & /
|
||||
(:|compress|./btoa|$a|$z)2>$m>&2||(sed '1,9s/./#define & /
|
||||
s/@/[w]/g
|
||||
s/C/char /g
|
||||
s/I/;if(/g
|
||||
|
||||
+8
-8
@@ -18,19 +18,19 @@
|
||||
|
||||
## Judges' comments
|
||||
|
||||
This program prints out a string. Can you figure out how
|
||||
it is done?
|
||||
This program prints out a string. Can you figure out how
|
||||
it is done?
|
||||
|
||||
By use of pointers to functions returning a struct of pointers
|
||||
to functions!
|
||||
By use of pointers to functions returning a struct of pointers
|
||||
to functions!
|
||||
|
||||
Note that some compilers will be unable to compile the
|
||||
expression 'X=g()...' in main due to lack of temporary
|
||||
value space. One might want to try replacing main with:
|
||||
Note that some compilers will be unable to compile the
|
||||
expression 'X=g()...' in main due to lack of temporary
|
||||
stack space. One might want to try replacing main with:
|
||||
|
||||
main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}
|
||||
|
||||
if this is a problem.
|
||||
if this is a problem.
|
||||
|
||||
|
||||
Spoiler: (rot13 to read)
|
||||
|
||||
+34
-33
@@ -11,7 +11,7 @@
|
||||
make all
|
||||
|
||||
|
||||
Modern compilers might fail to compile this entry:
|
||||
Modern compilers might fail to compile this entry:
|
||||
|
||||
scjones.c:1:7: error: expected ';' after top level declarator
|
||||
char*a??(??)=??<
|
||||
@@ -19,49 +19,50 @@
|
||||
;
|
||||
|
||||
|
||||
but we were able to get it to compile with modern compilers by specifying the
|
||||
`-ansi` flag with a tip from Yusuke Endoh. Thank you Yusuke!
|
||||
but we were able to get it to compile with modern compilers by specifying the
|
||||
`-ansi` flag with a tip from Yusuke Endoh. Thank you Yusuke!
|
||||
|
||||
|
||||
### To run
|
||||
### To run:
|
||||
|
||||
./scjones
|
||||
|
||||
## Judges' comments
|
||||
## Judges' comments:
|
||||
|
||||
The addition of trigraphs has made it easier to make programs
|
||||
hard to read. It was a dark and stormy night for C when the
|
||||
ANSI C committee added trigraphs to the standard. Too bad
|
||||
that they didn't just simply require a more reasonable ISO
|
||||
character set.
|
||||
The addition of trigraphs has made it easier to make programs
|
||||
hard to read. It was a dark and stormy night for C when the
|
||||
ANSI C committee added trigraphs to the standard. Too bad
|
||||
that they didn't just simply require a more reasonable ISO
|
||||
character set.
|
||||
|
||||
## Author's comments
|
||||
## Author's comments:
|
||||
|
||||
Since this year's contest is dedicated to ANSI C, here is a
|
||||
strictly conforming entry. In accordance with the ANSI
|
||||
definition of a strictly conforming program it does not produce
|
||||
output dependent on any unspecified, undefined, or implementation
|
||||
defined behavior, and it does not exceed any of the minimum
|
||||
implementation limits. It adheres to all of the syntactic and
|
||||
semantic constraints of the standard, #includes the relevant
|
||||
headers for the functions it uses, and uses the EXIT_SUCCESS and
|
||||
EXIT_FAILURE macros to return a correct success/fail status to
|
||||
the invoking program. It also uses trigraphs for characters
|
||||
which are not in the Invariant Code Set of ISO 646:1983, so it
|
||||
will be portable to machines with deficient (from C's standpoint)
|
||||
character sets. In short, it should be very widely portable. As
|
||||
an extra added attraction, all of the lines are under 72
|
||||
characters long, which would allow for sequence numbers to be
|
||||
punched in columns 73-80 :-).
|
||||
Since this year's contest is dedicated to ANSI C, here is a
|
||||
strictly conforming entry. In accordance with the ANSI
|
||||
definition of a strictly conforming program it does not produce
|
||||
output dependent on any unspecified, undefined, or implementation
|
||||
defined behavior, and it does not exceed any of the minimum
|
||||
implementation limits. It adheres to all of the syntactic and
|
||||
semantic constraints of the standard, #includes the relevant
|
||||
headers for the functions it uses, and uses the EXIT_SUCCESS and
|
||||
EXIT_FAILURE macros to return a correct success/fail status to
|
||||
the invoking program. It also uses trigraphs for characters
|
||||
which are not in the Invariant Code Set of ISO 646:1983, so it
|
||||
will be portable to machines with deficient (from C's standpoint)
|
||||
character sets. In short, it should be very widely portable. As
|
||||
an extra added attraction, all of the lines are under 72
|
||||
characters long, which would allow for sequence numbers to be
|
||||
punched in columns 73-80 :-).
|
||||
|
||||
[[ The Author sent us this note after he was informed that he won ]]
|
||||
[[ The Author sent us this note after he was informed that he won ]]
|
||||
|
||||
Although I am quite grateful for the "ANSI Committee's Worst Abuse
|
||||
of C" title (were you aware that I am a member of the committee or
|
||||
is the double meaning unintentional?), I was really hoping for
|
||||
something more along the lines of "Closest Resemblance to Line Noise." :-)
|
||||
> Although I am quite grateful for the "ANSI Committee's Worst Abuse of C" title
|
||||
(were you aware that I am a member of the committee or is the double meaning
|
||||
unintentional?), I was really hoping for something more along the lines of
|
||||
"Closest Resemblance to Line Noise." :-)
|
||||
|
||||
[[ ... it was unintentional ]]
|
||||
|
||||
[[ ... it was unintentional ]]
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
|
||||
+26
-22
@@ -13,39 +13,43 @@
|
||||
|
||||
make all
|
||||
|
||||
NOTE: that's not a typo but one can also do:
|
||||
|
||||
./o
|
||||
|
||||
## Judges' comments
|
||||
|
||||
We changed the alias that the author's suggested alias from a
|
||||
C-shell alias to a zsh alias.
|
||||
We changed the alias that the author's suggested alias from a
|
||||
C-shell alias to a zsh alias.
|
||||
|
||||
Note that shst.c is renamed to stig.c in the distribution.
|
||||
Note that shst.c is renamed to stig.c in the distribution.
|
||||
|
||||
WARNING: This program's 'how to compile' is too specific to a particular
|
||||
shell. The obfuscation of this program to more related to
|
||||
shell obfuscation than C obfuscation. This type of entry will
|
||||
not be permitted in future contests.
|
||||
shell. The obfuscation of this program to more related to
|
||||
shell obfuscation than C obfuscation. This type of entry will
|
||||
not be permitted in future contests.
|
||||
|
||||
## Author's comments
|
||||
|
||||
If you like shell programming you may also admire my
|
||||
creative quoting. (I use echo to create an alias
|
||||
which when run calls cc with the -D option to create a
|
||||
C macro with double quotes in it. ARRRRRGGGHHH!)
|
||||
If you like shell programming you may also admire my
|
||||
creative quoting. (I use echo to create an alias
|
||||
which when run calls cc with the -D option to create a
|
||||
C macro with double quotes in it. ARRRRRGGGHHH!)
|
||||
|
||||
The program is totally portable, but the compile
|
||||
commands are very shell specific so don't be TOO mad
|
||||
at me if they don't work for you.
|
||||
The program is totally portable, but the compile
|
||||
commands are very shell specific so don't be TOO mad
|
||||
at me if they don't work for you.
|
||||
|
||||
If you want to put these commands in a Makefile you
|
||||
must add 4 - four - backslashes at the end on first
|
||||
line. (At least that's what works here.)
|
||||
If you want to put these commands in a Makefile you
|
||||
must add 4 - four - backslashes at the end on first
|
||||
line. (At least that's what works here.)
|
||||
|
||||
If everything works correctly it create an executable
|
||||
named c which checks whether your compiler supports
|
||||
nested comments. I've stolen the "/*/*/0*/**/1" from
|
||||
somewhere so don't give me any points for it. Of
|
||||
course neither ANSI nor K&R support nested comments
|
||||
when properly implemented, but what the heck.
|
||||
If everything works correctly it create an executable
|
||||
named c which checks whether your compiler supports
|
||||
nested comments. I've stolen the `"/*/*/0*/**/1"` from
|
||||
somewhere so don't give me any points for it. Of
|
||||
course neither ANSI nor K&R support nested comments
|
||||
when properly implemented, but what the heck.
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
|
||||
+25
-14
@@ -1,10 +1,17 @@
|
||||
# Best Utility
|
||||
|
||||
Byron Rakitzis Sean Dorward
|
||||
Princeton University Princeton University
|
||||
5707 Old Lodge Dr. 10274 Burleigh Cottage Lane
|
||||
Houston, TX 77066 Ellicott City, MD 21043
|
||||
USA USA
|
||||
Byron Rakitzis
|
||||
Princeton University
|
||||
5707 Old Lodge Dr.
|
||||
Houston, TX 77066
|
||||
USA
|
||||
|
||||
Sean Dorward
|
||||
Princeton University
|
||||
10274 Burleigh Cottage Lane
|
||||
Ellicott City, MD 21043
|
||||
USA
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -16,13 +23,16 @@
|
||||
|
||||
## Judges' comments
|
||||
|
||||
This program implements a subject a well known Un*x utility whose
|
||||
original source was considered to be extremely obfuscated by many
|
||||
people, excluding its author. In fact, this utility was a major
|
||||
inspiration for the formation of this contest.
|
||||
|
||||
The author supplied us with a slightly smaller unformatted version
|
||||
of the program which we include below:
|
||||
This program touches on a well known Unix utility, the 6th edition Bourne Shell
|
||||
(`/bin/sh`), whose original source was considered to be extremely obfuscated by
|
||||
many people (although Steve Bourne might disagree). Did you know that the Bourne
|
||||
Shell source was a major inspiration for the formation of the IOCCC back in
|
||||
1984?
|
||||
|
||||
|
||||
The author supplied us with a slightly smaller unformatted version
|
||||
of the program which we include below:
|
||||
|
||||
#define D ,close(
|
||||
char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
|
||||
@@ -36,9 +46,10 @@
|
||||
e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;}
|
||||
|
||||
|
||||
Modern compilers had a problem with this entry because the exit(3) function
|
||||
returns void but we were able to get it to compile by using the comma
|
||||
operator which we also did in the smaller version.
|
||||
Modern compilers had a problem with this entry because the exit(3) function
|
||||
returns void but we were able to get it to compile by using the comma
|
||||
operator which we also did in the smaller version.
|
||||
|
||||
|
||||
## Author's comments
|
||||
|
||||
|
||||
+67
-55
@@ -11,91 +11,103 @@
|
||||
|
||||
make all
|
||||
|
||||
### To run
|
||||
NOTE: thanks to Yusuke Endoh for the pointing out that `atof()` nowadays needs
|
||||
`#include <stdlib.h>` in order to get this to work. Thanks also to Cody Boone
|
||||
Ferguson for fixing some segfaults under modern (and in some cases earlier)
|
||||
systems with this entry.
|
||||
|
||||
|
||||
## To run:
|
||||
|
||||
./theorem expression x1 x2 h y1
|
||||
|
||||
where:
|
||||
|
||||
expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
./theorem y 0 1 0.1 1
|
||||
|
||||
## Judges' comments
|
||||
|
||||
The program's source implements four functions, all from the
|
||||
same source file!
|
||||
|
||||
Usage:
|
||||
## Judges' comments:
|
||||
|
||||
theorem expression x1 x2 h y1
|
||||
The program's source implements four functions, all from the
|
||||
same source file!
|
||||
|
||||
where:
|
||||
expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)
|
||||
When you compile theorem.c as is and run with 5 args, it numerically
|
||||
solves the equation y'=f(x,y), with a step size of h, over the interval
|
||||
x=[x1,x2], with the initial condition of y(x1)=y1.
|
||||
|
||||
When you compile theorem.c as is and run with 5 args, it numerically
|
||||
solves the equation y'=f(x,y), with a step size of h, over the interval
|
||||
x=[x1,x2], with the initial condition of y(x1)=y1.
|
||||
The 'expression' f(x,y), is any function of 'x' and 'y' with the
|
||||
operators:
|
||||
|
||||
The 'expression' f(x,y), is any function of 'x' and 'y' with the
|
||||
operators:
|
||||
|
||||
+ - * / ^
|
||||
+ - * / ^
|
||||
|
||||
The symbol '^' is the power operator. Note that it only supports
|
||||
integer powers. Also note that all expressions are evaluated strictly
|
||||
left to right. (i.e., parenthesis aren't supported).
|
||||
The symbol '^' is the power operator. Note that it only supports
|
||||
integer powers. Also note that all expressions are evaluated strictly
|
||||
left to right. (i.e., parenthesis aren't supported).
|
||||
|
||||
Try running the program with the following args:
|
||||
Try running the program with the following args:
|
||||
|
||||
./theorem y 0 1 0.1 1
|
||||
./theorem 1/x 1 2 0.1 0
|
||||
./theorem 'x^2/y+x' 0 1 0.1 6
|
||||
|
||||
But wait, there is more! You also get, free of charge, a
|
||||
reversing filter! Try:
|
||||
|
||||
But wait, there is more! You also get, free of charge, a
|
||||
reversing filter! Try:
|
||||
|
||||
./theorem -r 0 0 0 0 < theorem.c > sorter.c
|
||||
|
||||
Still not impressed? The author throws in for free, a
|
||||
sort program! Try:
|
||||
|
||||
Still not impressed? The author throws in for free, a
|
||||
sort program! Try:
|
||||
|
||||
cc sorter.c -o sorter
|
||||
ls | ./sorter
|
||||
|
||||
This program is safe for home use as well. The author has
|
||||
included a safety feature in case you misplace the original
|
||||
program source:
|
||||
|
||||
./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c
|
||||
|
||||
And finally, as a special offer to users of this entry,
|
||||
the author provides a Fibonacci sequence generator! Try:
|
||||
This program is safe for home use as well. The author has
|
||||
included a safety feature in case you misplace the original
|
||||
program source:
|
||||
|
||||
./sorter 0 0 0 0 < theorem.c > fibonacci.c
|
||||
cc fibonacci.c -o fibonacci
|
||||
./fibonacci 1 1
|
||||
./fibonacci 2 1
|
||||
./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c
|
||||
|
||||
Program available 9 track and cartridge cassette. Gensu knife
|
||||
not included! :-)
|
||||
And finally, as a special offer to users of this entry,
|
||||
the author provides a Fibonacci sequence generator! Try:
|
||||
|
||||
When this program was first shown at the 1990 Summer Usenix
|
||||
conference, it received a standing ovation; a first for
|
||||
a contest entry.
|
||||
./sorter 0 0 0 0 < theorem.c > fibonacci.c
|
||||
cc fibonacci.c -o fibonacci
|
||||
./fibonacci 1 1
|
||||
./fibonacci 2 1
|
||||
|
||||
It should be noted that the 4 trailing args '0 0 0 0', are
|
||||
required on systems that dump core when NULL is dereferenced.
|
||||
Program available 9 track and cartridge cassette. Gensu knife
|
||||
not included! :-)
|
||||
|
||||
When this program was first shown at the 1990 Summer Usenix
|
||||
conference, it received a standing ovation; a first for
|
||||
a contest entry.
|
||||
|
||||
Originally we noted that the 4 trailing args '0 0 0 0' were required on systems
|
||||
that dump core when NULL is dereferenced but this problem showed itself in
|
||||
modern systems even with the 4 '0 0 0 0'. To make this easier for users Cody
|
||||
Boone Ferguson kindly fixed this problem.
|
||||
|
||||
|
||||
## Author's comments
|
||||
|
||||
Differential equations are solved via the Runge-Kutta method,
|
||||
which guarantees local error proportional to h^5, and total
|
||||
error across a finite interval is at most a constant times h^4.
|
||||
|
||||
Sorting is accomplished with a standard shell sort.
|
||||
Differential equations are solved via the Runge-Kutta method,
|
||||
which guarantees local error proportional to h^5, and total
|
||||
error across a finite interval is at most a constant times h^4.
|
||||
|
||||
Note that the sorting and reversing is limited to files with
|
||||
fewer than 500 lines, each less than 99 characters long.
|
||||
Sorting is accomplished with a standard shell sort.
|
||||
|
||||
Note that the sorting and reversing is limited to files with
|
||||
fewer than 500 lines, each less than 99 characters long.
|
||||
|
||||
Copyright (c) 1990, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#define X
|
||||
#define Y {}
|
||||
#define C }
|
||||
#define o {
|
||||
#undef main
|
||||
char m[500][99],v[99],R;
|
||||
int*a,b,n,i,j,W,A;
|
||||
char m[500][99],v[99],R,*a;
|
||||
int b,n,i,j,W,A;
|
||||
float Q,G,D,M,T,B,O,U,V,N,y,e();
|
||||
P(g,R,u)float*g,R,u;{int c;for(*g=1,c=u;c--;*g*=R);}
|
||||
X
|
||||
@@ -77,7 +79,7 @@ for(j=0;j<n;puts(j++[m]));
|
||||
e("",O,O,a);
|
||||
n=j-(O=1);
|
||||
while(gets(j++[m]));
|
||||
if(!strcmp(*++a,"-r"))S();
|
||||
if(!strcmp(++a,"-r"))S();
|
||||
C
|
||||
/**/main(A,a)int A;char*a[];
|
||||
Y
|
||||
@@ -90,4 +92,6 @@ float Q,G,D,M,T,O,B,U,V,N,e();
|
||||
#define o }
|
||||
#define C {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
@@ -10,12 +10,16 @@
|
||||
|
||||
make all
|
||||
|
||||
NOTE: This entry might not compile when using modern compilers.
|
||||
NOTE: This entry might not compile when using modern compilers.
|
||||
|
||||
### To run
|
||||
|
||||
./westley 1
|
||||
|
||||
NOTE: this entry will segfault without an arg and will enter an infinite loop if
|
||||
input is not a number (or is a negative number).
|
||||
|
||||
|
||||
## Judges' comments
|
||||
|
||||
usage: westley <number>
|
||||
|
||||
+4
-1
@@ -912,7 +912,7 @@ Contest </I></FONT></CENTER>
|
||||
<LI>A minor bug that shows up in some cases was found by
|
||||
<a href="winners.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a>
|
||||
when working on his <a href="#2020_ferguson2">2020 Enigma machine</a>. See his
|
||||
README.md file for details (search for vik).
|
||||
README.md file for details (search for vik).</LI>
|
||||
</UL>
|
||||
<A NAME="2014_wiedijk"></A>
|
||||
<P><B>wiedijk</B> - Y combinator</P>
|
||||
@@ -2938,6 +2938,9 @@ README.md file for details (search for vik).
|
||||
<UL TYPE=square>
|
||||
<LI><A HREF="1990/theorem/Makefile">Makefile</A>
|
||||
<LI><A HREF="1990/theorem/theorem.c">theorem.c</A>
|
||||
<LI><a href="winners.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed
|
||||
some segfaults under modern systems (and in some cases older systems) in this
|
||||
entry. Thank you Cody!</LI>
|
||||
</UL>
|
||||
<A NAME="1990_westley"></A>
|
||||
<P><B>westley</B> - poetic exchange between lovers, prints "luvs me, luvs not"</P>
|
||||
|
||||
Reference in new issue
Block a user