Merge pull request #845 from xexyl/1987-lievaart
Remove probable bug status from 1987/lievaart
This commit is contained in:
22 files changed
+554
-563
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 52 KiB |
@@ -139,8 +139,9 @@ alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
${ALT_TARGET}: ${PROG}.alt.c
|
||||
@echo "NOTE: This entry may not work on some systems."
|
||||
@echo "** NOTE: this version might not work on some systems **"
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
@echo "** NOTE: this version might not work on some systems **"
|
||||
|
||||
# data files
|
||||
#
|
||||
|
||||
@@ -18,8 +18,10 @@ make all
|
||||
### Alternate code:
|
||||
|
||||
The original version of this entry was added, by request,
|
||||
in order to show the code that was turned into the [tattoo]
|
||||
(https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php).
|
||||
in order to show the code that was turned into the
|
||||
[tattoo](https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php).
|
||||
See below in this file for the image.
|
||||
|
||||
|
||||
#### To build:
|
||||
|
||||
@@ -30,7 +32,7 @@ make alt
|
||||
#### To run:
|
||||
|
||||
```sh
|
||||
echo NOTE: This entry may not work on some systems.
|
||||
echo NOTE: this version might not work on some systems.
|
||||
./anonymous.alt
|
||||
```
|
||||
|
||||
@@ -46,7 +48,7 @@ program. What reads like a read may be written like a write!
|
||||
In 2005 someone by the name of Thomas Scovell got a tattoo of this entry. See
|
||||
his [web
|
||||
page](https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php)
|
||||
for more information on the tattoo. This is what it looks like:
|
||||
for more information on the tattoo. Along with the code, this is what it looks like:
|
||||
|
||||
|
||||

|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
# Grand Prize
|
||||
|
||||
Roemer B. Lievaart
|
||||
VU Informatica
|
||||
Churchilllaan 173-IV
|
||||
Amsterdam, The Netherlands
|
||||
Netherlands
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -21,8 +19,11 @@ compiler.
|
||||
# enter a level and start playing as described below
|
||||
```
|
||||
|
||||
NOTE: if you enter invalid input the program will enter an infinite loop
|
||||
displaying a string like `"You:"` repeatedly.
|
||||
### INABIAF - it's not a bug it's a feature! :-)
|
||||
|
||||
If you enter invalid input the program will enter an infinite loop displaying a
|
||||
string like `"You:"` repeatedly (for instance if you input `.`). If you enter an
|
||||
incorrect value it will prompt you again until you input a proper value.
|
||||
|
||||
## Try:
|
||||
|
||||
|
||||
+3
-3
@@ -62,10 +62,10 @@ quit # for the cat version
|
||||
|
||||
What we found amazing was how the flow of control was transferred
|
||||
between subroutines. Careful inspection will show that the array of
|
||||
pointers to functions named 'vi' refers to functions which seem to not
|
||||
pointers to functions named `vi` refers to functions which seem to not
|
||||
be directly called. Even so, these pointers to functions are being
|
||||
used as an argument to signal. Can you determine why this is being
|
||||
done and how it is being exploited?
|
||||
used as an argument to `signal()` (used both with and without an arg - but
|
||||
how?). Can you determine why this is being done and how it is being exploited?
|
||||
|
||||
Some compilers complained about this file, so we changed: `=++I` to `= ++I`.
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
# Best Layout
|
||||
|
||||
Brian Westley (aka Merlyn Leroy on usenet)
|
||||
Starfire Consulting
|
||||
1121 Hamline Ave. N. #17
|
||||
St. Paul, MN
|
||||
55108
|
||||
US
|
||||
Brian Westley (aka Merlyn Leroy on usenet)<br>
|
||||
US<br>
|
||||
<http://www.westley.org>
|
||||
|
||||
## To build:
|
||||
|
||||
+3
-3
@@ -11,15 +11,15 @@
|
||||
#define l 1
|
||||
#define f write
|
||||
#define J else
|
||||
#define a(x)get/***/x/***/id())
|
||||
#define a(x)get##x##id())
|
||||
P z[l<<(1<<l<<1)<<1<<(l<<1)<<(l<<l<<l)<<1],*v;p r,A=0,c=1;
|
||||
q(Q)P*Q;{L(*++Q){*Q-=7;q(Q);}}main(V,C)P**C;{
|
||||
p Z=chroot("/");L(!getuid())execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
|
||||
p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
|
||||
while(V){
|
||||
case_3:L(!(*C[c]-'-')&&!(C[c][c]-'n')&&!C[c][c<<c])V--,C++,Z=c;
|
||||
case 1:O/*/*/0)+O(c*c-c+c/c)<<(c*c));dup(c);O/*/*/c);pipe(z);L(
|
||||
fork()){O c);
|
||||
case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++;
|
||||
case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*a(g);};C++;
|
||||
f(c/c+c*c,*C,H C));I h;}J O/*/*/c/c+V/V+A*(p)C);
|
||||
case 0:c=read(1,z,r=H++C));L(c){L(A++)f('-'-'-'-'+'+'+'," ",'/'/'/');
|
||||
f(A-A+c-r-c+r,z,r);}J _exit(Z?Z-Z:Z);};main(chroot("/tmp")+l,C);
|
||||
|
||||
@@ -13,9 +13,8 @@ make all
|
||||
|
||||
and then type a C program into followed by EOF (usually `^D`, ctrl-d).
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made a version (also
|
||||
one line) for clang. See the Alternate code section below for how to use.
|
||||
Thank you Cody for your assistance!
|
||||
An alternate version (also one-line) that will work with clang has been
|
||||
provided. See the Alternate code section below for how to use.
|
||||
|
||||
## Try:
|
||||
|
||||
@@ -61,12 +60,9 @@ NOTE: you need to make clobber first for this entry to work right.
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
We enjoyed this entry this year, however in the future programs must be able to
|
||||
We enjoyed this entry this year; however in the future programs must be able to
|
||||
be compiled from within a Makefile without the need of human intervention.
|
||||
|
||||
Meanwhile Cody was twisted enough to point out (though to be fair he felt sick
|
||||
doing this) that with a slight modification this entry can be C++ instead. We don't
|
||||
thank him for this ghastly point! :-)
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
|
||||
+8
-20
@@ -1,11 +1,7 @@
|
||||
# Best layout
|
||||
|
||||
Merlyn LeRoy (Brian Westley)
|
||||
Rosemount, Inc.
|
||||
1121 Hamline Ave. N. #17
|
||||
St. Paul, MN
|
||||
55108
|
||||
U.S.A.
|
||||
US
|
||||
<http://www.westley.org>
|
||||
|
||||
## To build:
|
||||
@@ -14,8 +10,9 @@ U.S.A.
|
||||
make all
|
||||
```
|
||||
|
||||
NOTE: this version is a fixed version for modern C compilers. The Alternate
|
||||
code below is the original.
|
||||
NOTE: this version is a fixed version for modern C compilers. See the Alternate
|
||||
code section below for how to use the original.
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
@@ -23,18 +20,6 @@ code below is the original.
|
||||
./westley
|
||||
```
|
||||
|
||||
### Alternate code:
|
||||
|
||||
The alternate code in [westley.alt.c](westley.alt.c) is the original version
|
||||
submitted to the contest. If you have an old enough compiler you can run it
|
||||
like:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
Use `westley.alt` as you would `westley` above.
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Your compiler must parse
|
||||
@@ -53,10 +38,13 @@ by changing the #define line to:
|
||||
#define _ F-->00||F-OO--;
|
||||
```
|
||||
|
||||
This is what the modified code in [westley.c](westley.c) does whereas the alt
|
||||
code is the original.
|
||||
|
||||
You might enjoy looking at the output of:
|
||||
|
||||
```sh
|
||||
cc -E westley.c
|
||||
cc -E westley.alt.c
|
||||
```
|
||||
|
||||
### Alternate code:
|
||||
|
||||
+20
-3
@@ -113,8 +113,8 @@ OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
ALT_OBJ= ver0.o ver1.o ver2.o ver3.o
|
||||
ALT_TARGET= ver0 ver1 ver2 ver3
|
||||
|
||||
|
||||
#################
|
||||
@@ -129,7 +129,6 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: This entry uses non-standard args to main() that do not work with some modern compilers."
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
@@ -137,6 +136,24 @@ ${PROG}: ${PROG}.c
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
ver0: ver0.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
ver1: ver1.c
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
|
||||
ver2: ver2.c
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
|
||||
ver3: ver3.c
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
|
||||
+22
-19
@@ -1,10 +1,6 @@
|
||||
# Most algorithms in one program
|
||||
|
||||
Merlyn LeRoy (Brian Westley)
|
||||
Starfire Consulting
|
||||
1026 Blair Ave.
|
||||
St. Paul, MN
|
||||
55104
|
||||
US
|
||||
<http://www.westley.org>
|
||||
|
||||
@@ -15,16 +11,14 @@ make all
|
||||
```
|
||||
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) was able to get
|
||||
this to partially work with clang; clang requires that the second, third and
|
||||
fourth args to main() be `char **`. Only `westley.c` and `ver0.c` (see below) will
|
||||
NOTE: this entry only partly works with clang; clang requires that the second, third and
|
||||
fourth args to `main()` be `char **`. Only `westley.c` and `ver0.c` (see below) will
|
||||
compile with clang. It's possible to get `ver1.c` to compile too but this causes
|
||||
problems with generating the output of the remaining files so we have opted, at
|
||||
least for now, to not do that, as it does not have to output just source code.
|
||||
He notes that the original source code sometimes segfaults with `ver2` which
|
||||
also happens with the fix but it'll only compile with a compiler that
|
||||
does not require the second, third and fourth args of main() to be a `char **`.
|
||||
Thank you Cody for your help!
|
||||
The original source code sometimes segfaults with `ver2` which also happens with
|
||||
the fix but it'll only compile with a compiler that does not require the second,
|
||||
third and fourth args of `main()` to be a `char **`.
|
||||
|
||||
|
||||
## Try:
|
||||
@@ -46,12 +40,22 @@ make ver2
|
||||
make ver3
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```sh
|
||||
./westley
|
||||
# input some lines of text, sending EOF (usually ctrl-d) to end
|
||||
echo IOCCC | ./ver0
|
||||
echo Version 1 | ./ver1
|
||||
echo Version 2 | ./ver2
|
||||
echo Version 3 | ./ver3
|
||||
```
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
|
||||
There is a secret way to get ONE of the versions to print out
|
||||
"Hello, world!\n". Can you find how to do it?
|
||||
"`Hello, world!\n`". Can you find how to do it?
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
@@ -91,7 +95,7 @@ check for ROT13 version] is all it complains about).
|
||||
|
||||
`ver0` and `ver1` use a range check and a calculation to do ROT13,
|
||||
while `ver2` and `ver3` use table lookup. All versions contain
|
||||
`main()` and it's ROT13 fn, `znva()`. `ver0`/`ver1` [`ver2`/`ver3`] are
|
||||
`main()` and its ROT13 function, `znva()`. `ver0`/`ver1` [`ver2`/`ver3`] are
|
||||
(of course) syntactically identical, since the syntax is in the
|
||||
non-alphabetic characters. However, since one program starts
|
||||
at `main()` while it's ROT13 counterpart starts at `znva()`, `znva()`
|
||||
@@ -132,17 +136,16 @@ expr1 && (expr2,expr3);
|
||||
`expr2` was OFTEN evaluated even if `expr1` was false. I removed
|
||||
such statements to make it more portable.
|
||||
|
||||
The variable names are worth noting:
|
||||
### Variable names worth noting
|
||||
|
||||
--
|
||||
|
||||
'irk' and 'vex' are ROT13 pairs and are synonyms.
|
||||
`irk` and `vex` are ROT13 pairs and are synonyms.
|
||||
|
||||
'Near' and 'Arne' are ROT13 pairs and are anagrams.
|
||||
`Near` and `Arne` are ROT13 pairs and are anagrams.
|
||||
|
||||
'NOON' and 'ABBA' are ROT13 pairs and are palindromes.
|
||||
`NOON` and `ABBA` are ROT13 pairs and are palindromes.
|
||||
|
||||
'tang' and 'gnat' are both ROT13 and palindrome pairs!
|
||||
`tang` and `gnat` are both ROT13 and palindrome pairs!
|
||||
|
||||
--
|
||||
|
||||
|
||||
+50
-51
@@ -1,15 +1,9 @@
|
||||
# Best Utility
|
||||
|
||||
Byron Rakitzis
|
||||
Princeton University
|
||||
5707 Old Lodge Dr.
|
||||
Houston, TX 77066
|
||||
US
|
||||
|
||||
Sean Dorward
|
||||
Princeton University
|
||||
10274 Burleigh Cottage Lane
|
||||
Ellicott City, MD 21043
|
||||
US
|
||||
|
||||
|
||||
@@ -83,61 +77,66 @@ applied.
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
### Rot13:
|
||||
This program is a rudimentary shell. It does i/o redirection, pipes
|
||||
and cd. It flags errors on failed `chdir()`, `open()`, `creat()`,
|
||||
`execvp()`, `fork()` and a few syntax errors.
|
||||
|
||||
Guvf cebtenz vf n ehqvzragnel furyy. Vg qbrf v/b erqverpgvba, cvcrf
|
||||
naq pq. Vg syntf reebef ba snvyrq puqve'f, bcra'f, perng'f
|
||||
rkrpic'f, sbex'f naq n srj flagnk reebef.
|
||||
This program is obfuscated in a few notable ways: apart from the layout (an
|
||||
unformatted (but crunched) version is included for people who want to put this
|
||||
through cb) it makes clever use of a write statement, so that the same statement
|
||||
can be used to print errors and the prompt. By calling the error function with
|
||||
the value `-8`, the pointer offset in the expression `"?\n$ "-x/4` goes from 0
|
||||
to 2. Presto! A prompt. For errors with numbers smaller than `-4` (i.e., UNIX
|
||||
system calls) a question mark is printed.
|
||||
|
||||
Guvf cebtenz vf boshfpngrq va n srj abgnoyr jnlf: ncneg sebz gur
|
||||
ynlbhg (na hasbeznggrq (ohg pehapurq) irefvba vf vapyhqrq sbe
|
||||
crbcyr jub jnag gb chg guvf guebhtu po) vg znxrf pyrire hfr bs n
|
||||
jevgr fgngrzrag, fb gung gur fnzr fgngrzrag pna or hfrq gb cevag
|
||||
reebef naq gur cebzcg. Ol pnyyvat gur reebe shapgvba jvgu gur inyhr
|
||||
-8, gur cbvagre bssfrg va gur rkcerffvba "?\a$ "-k/4 tbrf sebz 0 gb
|
||||
2. Cerfgb! N cebzcg. Sbe reebef jvgu ahzoref fznyyre guna -4
|
||||
(v.r., HAVK flfgrz pnyyf) n dhrfgvba znex vf cevagrq.
|
||||
The error value of `chdir()` is doubled so that we don't exit from the parent
|
||||
shell on a `chdir()` error (since `e()` exits on `-1` errors only). All other
|
||||
system call failures exit since they are from subshells.
|
||||
|
||||
Gur reebe inyhr bs puqve vf qbhoyrq fb gung jr qba'g rkvg sebz gur
|
||||
cnerag furyy ba n puqve reebe (fvapr r() rkvgf ba -1 reebef bayl).
|
||||
Nyy bgure flfgrz pnyy snvyherf rkvg fvapr gurl ner sebz fhofuryyf.
|
||||
Recursion is sneakily employed to avoid a second call to `fork()`,
|
||||
and the line is parsed in a fairly bizarre fashion: backwards. The
|
||||
heart of the program, that is, the part which performs all `fork()`s,
|
||||
`exec()`s, `open()`s, etc. is ONE C STATEMENT.
|
||||
|
||||
Erphefvba vf farnxvyl rzcyblrq gb nibvq n frpbaq pnyy gb sbex(),
|
||||
naq gur yvar vf cnefrq va n snveyl ovmneer snfuvba: onpxjneqf. Gur
|
||||
urneg bs gur cebtenz, gung vf, gur cneg juvpu cresbezf nyy sbexf,
|
||||
rkrpf, bcraf, rgp. vf BAR P FGNGRZRAG.
|
||||
The meta-values array is initialized in a bizarre fashion, and the
|
||||
subsequent checks for the `'<'` and `'>'` are performed in a single
|
||||
statement using a mask, since you know that `'>'&2` is 0, whereas
|
||||
`'<'&2` is 2. Other such micro-obfuscations abound.
|
||||
|
||||
Gur zrgn-inyhrf neenl vf vavgvnyvmrq va n ovmneer snfuvba, naq gur
|
||||
fhofrdhrag purpxf sbe gur '<' naq '>' ner cresbezrq va n fvatyr
|
||||
fgngrzrag hfvat n znfx, fvapr lbh xabj gung '>'&2 vf 0, jurernf
|
||||
'<'&2 vf 2. Bgure fhpu zvpeb-boshfpngvbaf nobhaq.
|
||||
Finally, it is notable that the code was hacked for minimality. If
|
||||
you look at the compressed version, you will be hard-pressed to
|
||||
eliminate more than a few characters (we can't see how to make it
|
||||
any smaller!). 550 characters is pretty lean for a shell that does
|
||||
this much.
|
||||
|
||||
Svanyyl, vg vf abgnoyr gung gur pbqr jnf unpxrq sbe zvavznyvgl. Vs
|
||||
lbh ybbx ng gur pbzcerffrq irefvba, lbh jvyy or uneq-cerffrq gb
|
||||
ryvzvangr zber guna n srj punenpgref (jr pna'g frr ubj gb znxr vg
|
||||
nal fznyyre!). 550 punenpgref vf cerggl yrna sbe n furyy gung qbrf
|
||||
guvf zhpu.
|
||||
### BUGS
|
||||
|
||||
OHTF
|
||||
The syntax of the shell has not been fully explored, but if you try
|
||||
to redirect in the same direction more than once, only one
|
||||
redirection is performed. This is a "feature" of the way the line
|
||||
is parsed; a pointer to the stack of arguments is assigned and an
|
||||
argument is stolen every time a `>` or `<` is encountered. The
|
||||
shell flags an error if no arguments are on the stack. Thus, for
|
||||
example:
|
||||
|
||||
Gur flagnk bs gur furyy unf abg orra shyyl rkcyberq, ohg vs lbh gel
|
||||
gb erqverpg va gur fnzr qverpgvba zber guna bapr, bayl bar
|
||||
erqverpgvba vf cresbezrq. Guvf vf n "srngher" bs gur jnl gur yvar
|
||||
vf cnefrq; n cbvagre gb gur fgnpx bs nethzragf vf nffvtarq naq na
|
||||
nethzrag vf fgbyra rirel gvzr n ">" be "<" vf rapbhagrerq. Gur
|
||||
furyy syntf na reebe vs ab nethzragf ner ba gur fgnpx. Guhf, sbe
|
||||
rknzcyr:
|
||||
png > sbb > one
|
||||
pngf gb sbb, fvapr vg jnf chfurq ynfg, ohg
|
||||
png > > sbb one
|
||||
pngf gb one, fvapr one jnf chfurq haqre sbb. (erzrzore jr'er
|
||||
cnefvat evtug-yrsg)
|
||||
```sh
|
||||
cat > foo > bar
|
||||
```
|
||||
|
||||
Qrcraqvat ba lbhe synibe bs HA*K, pq jvgubhg na nethzrag jvyy
|
||||
rvgure cebqhpr na reebe be whfg qb abguvat.
|
||||
cats to foo, since it was pushed last, but
|
||||
|
||||
Gurer vf whfg bar reebe zrffntr, gur dhrfgvba znex, ohg url, gung'f
|
||||
nyy rq qbrf gbb.
|
||||
```sh
|
||||
cat > > foo bar
|
||||
```
|
||||
|
||||
cats to bar, since bar was pushed under foo (remember we're
|
||||
parsing right-left).
|
||||
|
||||
Depending on your flavor of Unix, cd without an argument will
|
||||
either produce an error or just do nothing.
|
||||
|
||||
There is just one error message, the question mark, but hey, that's
|
||||
all ed does too.
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -21,11 +21,12 @@ make all
|
||||
./westley number
|
||||
```
|
||||
|
||||
NOTE: this program will enter an infinite loop if input is not a number > 0.
|
||||
|
||||
### INABIAF - it's not a bug it's a feature :-)
|
||||
|
||||
NOTE: this entry will very likely crash or do something else without an arg.
|
||||
This entry will very likely crash or do something else without an arg.
|
||||
|
||||
This program will enter an infinite loop if input is not a number > 0.
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
+12
-16
@@ -64,12 +64,12 @@ other types of files?
|
||||
|
||||
### Alternate code:
|
||||
|
||||
The alternate code allows this entry to work successfully even with clang. [Cody
|
||||
Boone Ferguson](/winners.html#Cody_Boone_Ferguson) notes that unfortunately it's
|
||||
something of a hack or maybe even a kludge. This however seems important because
|
||||
it works well and allows for not messing with the `s` string which is quite
|
||||
complicated. Even changing the length could break functionality and indeed the
|
||||
length would have to be longer for this to work with clang.
|
||||
The alternate code allows this entry to work successfully even with clang.
|
||||
Unfortunately it's something of a hack or maybe even a kludge. This however
|
||||
seems important because it works well and allows for not messing with the `s`
|
||||
string which is quite complicated. Even changing the length could break
|
||||
functionality and indeed the length would have to be longer for this to work
|
||||
with clang.
|
||||
|
||||
How does it work? The code (which you will see in [dds.c](dds.c)) does a `return
|
||||
system(q-6);` which equates to `return system("cc a.c");` but clang by default,
|
||||
@@ -79,13 +79,12 @@ that the compilation failed with clang (because it didn't use `make` so no
|
||||
[LANDER.BAS](LANDER.BAS)) due to a return from `main()` without a return value
|
||||
and the use of functions not yet declared.
|
||||
|
||||
Now as noted since the string `s` is complicated and to not
|
||||
inadvertently mess something up Cody changed that code to `system("make a");`
|
||||
and then added the right rule to the Makefile. Thus for the alternative version
|
||||
you now need both `make` and `cc`. If you use gcc you may change the system()
|
||||
call to what was given in this description to get a more authentic feel. If you
|
||||
do this you must then run `./a.out` not `./a`! Thus to use the alternative
|
||||
version:
|
||||
Now as noted since the string `s` is complicated and to not inadvertently mess
|
||||
something up it was changed so that the code uses `system("make a");` and then an
|
||||
appropriate rule was added to the Makefile. Thus for the alternative version you
|
||||
now need both `make` and `cc`. If you use gcc you can change the `system()` call
|
||||
to what was given in this description to get a more authentic feel. If you do
|
||||
this you must then run `./a.out` not `./a`! Thus to use the alternative version:
|
||||
|
||||
```sh
|
||||
make clobber alt
|
||||
@@ -101,9 +100,6 @@ produced? How does `a.c` relate to [LANDER.BAS](LANDER.BAS)?
|
||||
This obfuscated program translates BASIC programs into obfuscated
|
||||
C programs by way of an obfuscated algorithm.
|
||||
|
||||
NOTE: Due to minor problems with some strict ANSI C compilers, we
|
||||
have supplied a more portable ANSI version.
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ sh ./clock1
|
||||
```
|
||||
|
||||
|
||||
NOTE: the original version had a display problem in modern systems which
|
||||
somewhat affected the usability of the program. See the Alternate code section
|
||||
for details on the original version.
|
||||
|
||||
## Try:
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ Germany
|
||||
make all
|
||||
```
|
||||
|
||||
An alternate version for this entry works with macOS. See the Alternate code
|
||||
section below for more details.
|
||||
|
||||
|
||||
## To run:
|
||||
|
||||
@@ -23,11 +26,11 @@ make all
|
||||
|
||||
### Alternate code:
|
||||
|
||||
As noted above the alternate version works with macOS but there are some important notes as
|
||||
well as a description of how it works (spoilers for the original version as
|
||||
well).
|
||||
As noted above the alternate version works with macOS but there are some
|
||||
important notes as well as a description of how it works (spoilers for the
|
||||
original version as well).
|
||||
|
||||
An MacBook Pro Max with the M1 chip some header files report an
|
||||
With a MacBook Pro Max with the M1 chip some header files report an
|
||||
unsupported architecture and unsupported compiler (error, warning).
|
||||
However the defines are still found okay.
|
||||
|
||||
@@ -60,7 +63,14 @@ This allows for opening the right files. The problem with the macOS is
|
||||
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include` which is why
|
||||
the different command line and the different numbers.
|
||||
|
||||
To use this version use `schweikh1.alt` instead.
|
||||
To use this version use:
|
||||
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
Use `schweikh1.alt` as you would `schweikh1` above.
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
@@ -73,7 +83,7 @@ standard headers.
|
||||
|
||||
This code is a wonder; it's a wonder that it compiles. I wonder
|
||||
whether or not it should. The innovative realization that you can
|
||||
use special characters, such as `'\n'`, in #file directives alone
|
||||
use special characters, such as `'\n'`, in `#file` directives alone
|
||||
merits some recognition.
|
||||
|
||||
I've included most of the author's remarks; they're fairly thorough.
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
char
|
||||
*T="IeJKLMaYQCE]jbZRskc[SldU^V\\X\\|/_<[<:90!\"$434-./2>]s",
|
||||
K[3][1000],*F,x,A,*M[2],*J,r[4],*g,N,Y,*Q,W,*k,q,D;X(){r [r
|
||||
[r[3]=M[1-(x&1)][*r=W,1],2]=*Q+2,1]=x+1+Y,*g++=((((x& 7)
|
||||
-1)>>1)-1)?*r:r[x>>3],(++x<*r)&&X();}E(){A||X(x=0,g =J
|
||||
),x=7&(*T>>A*3),J[(x[F]-W-x)^A*7]=Q[x&3]^A*(*M)[2 +(
|
||||
x&1)],g=J+((x[k]-W)^A*7)-A,g[1]=(*M)[*g=M[T+=A ,1
|
||||
][x&1],x&1],(A^=1)&&(E(),J+=W);}l(){E(--q&&l ()
|
||||
);}B(){*J&&B((D=*J,Q[2]<D&&D<k[1]&&(*g++=1 ),
|
||||
!(D-W&&D-9&&D-10&&D-13)&&(!*r&&(*g++=0) ,*
|
||||
r=1)||64<D&&D<91&&(*r=0,*g++=D-63)||D >=
|
||||
97&&D<123&&(*r=0,*g++=D-95)||!(D-k[ 3]
|
||||
)&&(*r=0,*g++=12)||D>k[3]&&D<=k[ 1]
|
||||
-1&&(*r=0,*g++=D-47),J++));}j( ){
|
||||
putchar(A);}b(){(j(A=(*K)[D* W+
|
||||
r[2]*Y+x]),++x<Y)&&b();}t ()
|
||||
{(j((b(D=q[g],x=0),A=W) ),
|
||||
++q<(*(r+1)<Y?*(r+1): Y)
|
||||
)&&t();}R(){(A=(t( q=
|
||||
0),'\n'),j(),++r [2
|
||||
]<N)&&R();}O() {(
|
||||
j((r[2]=0,R( ))
|
||||
),r[1]-=q) &&
|
||||
O(g-=-q) ;}
|
||||
C(){( J=
|
||||
gets (K
|
||||
[1]))&&C((B(g=K[2]),*r=!(!*r&&(*g++=0)),(*r)[r]=g-K[2],g=K[2
|
||||
],r[
|
||||
1]&&
|
||||
O())
|
||||
);;}
|
||||
main
|
||||
(){C
|
||||
((l(
|
||||
(J=(
|
||||
A=0)
|
||||
[K],
|
||||
A[M]
|
||||
=(F=
|
||||
(k=(
|
||||
M[!A
|
||||
]=(Q
|
||||
=T+(
|
||||
q=(Y
|
||||
=(W=
|
||||
32)-
|
||||
(N=4
|
||||
))))
|
||||
+N)+
|
||||
2)+7
|
||||
)+7)
|
||||
),Y=
|
||||
N<<(
|
||||
*r=!
|
||||
-A))
|
||||
);;}
|
||||
@@ -1,9 +1,6 @@
|
||||
# Best AI
|
||||
|
||||
Doug Beardsley
|
||||
Southern Adventist University
|
||||
359 Davis Rd. NW
|
||||
Cleveland, TN 37312
|
||||
US
|
||||
|
||||
|
||||
@@ -24,7 +21,8 @@ make
|
||||
### Alternate code:
|
||||
|
||||
The author provided a way to speed it up a bit and also how to make it so it
|
||||
doesn't crash on losing.
|
||||
doesn't crash on losing. The idea that it crashes on losing was too good to
|
||||
lose but this alternate version has the former change.
|
||||
|
||||
To compile:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Largest small system emulator
|
||||
|
||||
Adrian Cable
|
||||
<adrian.cable@gmail.com>
|
||||
Adrian Cable<br>
|
||||
<adrian.cable@gmail.com>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+27
-26
@@ -2,7 +2,7 @@
|
||||
|
||||
The `author/` directory contains a JSON file for each author of at
|
||||
least one winning IOCCC entry. For each author, there is a JSON
|
||||
file of the form:
|
||||
file with the following name format:
|
||||
|
||||
```
|
||||
author/author_handle.json
|
||||
@@ -19,15 +19,15 @@ an IOCCC unique string that matches this regex:
|
||||
^[0-9a-z][0-9a-z_]*$
|
||||
```
|
||||
|
||||
The `author_handle`, by default derived from the name of the author.
|
||||
The `author_handle`, by default, is derived from the name of the author.
|
||||
While there is a algorithm that maps the name of the author
|
||||
(which can contain any UTF-8 characters) into a default
|
||||
`author_handle` string, those who submit an entry to the IOCCC
|
||||
are free to choose a different `author_handle` string.
|
||||
|
||||
An `author` who has won a previous IOCCC is encouraged to
|
||||
reuse their author_handle so that new winners an be associated
|
||||
with the same author.
|
||||
An `author` who has won a previous IOCCC is encouraged to reuse their
|
||||
author_handle so that new winning entries will be associated with the same
|
||||
author or authors.
|
||||
|
||||
### anonymous author_handle's
|
||||
|
||||
@@ -70,15 +70,15 @@ There must be the following JSON members:
|
||||
"location_name" : "Formal location name",
|
||||
```
|
||||
|
||||
- "full_name" value is the author's formal full name.
|
||||
- "sort_word" value is the author's last name, mapped into lower case ASCII, as JSON encoded string
|
||||
- "location_code" value is an 2 UPPER CASE ISO 3166 code selected by the author
|
||||
- "location_name" value is the formal name corresponding to the "location_code", in JSON encoded string form
|
||||
- `"full_name"` value is the author's formal full name.
|
||||
- `"sort_word"` value is the author's last name, mapped into lower case ASCII, as a JSON encoded string
|
||||
- `"location_code"` value is a 2 UPPER CASE ISO 3166 code selected by the author
|
||||
- `"location_name"` value is the formal name corresponding to the `"location_code"`, in JSON encoded string form
|
||||
|
||||
A "sort_word" hat is used to determine the position within the `winners.html` file,
|
||||
a `author` and the `winners` they submitted are to be listed.
|
||||
A `"sort_word"` that is used to determine the position within the `winners.html` file,
|
||||
an `author` and the `winners` they submitted are to be listed.
|
||||
|
||||
A `sort_word` match this regexp:
|
||||
A `sort_word` matches this regexp:
|
||||
|
||||
```re
|
||||
^[a-z][0-9a-z]*
|
||||
@@ -97,17 +97,17 @@ And there must be the following JSON members:
|
||||
"affiliation" : "an affiliation group",
|
||||
```
|
||||
|
||||
- "email" value is the author's email address as a JSON encoded string, or `null` if not given
|
||||
- "url;" value is the author's home page URL as a JSON encoded string, or `null` if not given
|
||||
- "alt_url" value is the author's alternate URL as a JSON encoded string, or `null` if not given
|
||||
- "deprecated_twitter_handle" value is the author's twitter handle as a JSON encoded string, starting with "_@_", or `null` if not given
|
||||
- "mastodon" value is the author's Mastodon handle in "_@user@server_" form as a JSON encoded string, or `null` if not given
|
||||
- "mastodon_url" value is the URL as a JSON encoded string of the author's Mastodon page, cor `null` if not given
|
||||
- "github" value is the GitHub username as a JSON encoded string, starting with "_@_", or `null` if not given
|
||||
- "affiliation" is the author's affiliation as a JSON encoded string, or `null` if not given
|
||||
- `"email"` value is the author's email address as a JSON encoded string, or `null` if not given
|
||||
- `"url"` value is the author's home page URL as a JSON encoded string, or `null` if not given
|
||||
- `"alt_url"` value is the author's alternate or second URL as a JSON encoded string, or `null` if not given
|
||||
- `"deprecated_twitter_handle"` value is the author's twitter handle as a JSON encoded string, starting with "_@_", or `null` if not given
|
||||
- `"mastodon"` value is the author's Mastodon handle in "_@user@server_" form as a JSON encoded string, or `null` if not given
|
||||
- `"mastodon_url"` value is the URL as a JSON encoded string of the author's Mastodon page, or `null` if not given
|
||||
- `"github"` value is the author's GitHub username as a JSON encoded string, starting with "_@_", or `null` if not given
|
||||
- `"affiliation"` is the author's affiliation as a JSON encoded string, or `null` if not given
|
||||
|
||||
If an author does not have one of the previous set of values, or wishes to not disclose it / keep it anonymous,
|
||||
then the JSON value of `null`. For example:
|
||||
then the JSON value can be `null`. For example:
|
||||
|
||||
```json
|
||||
"email" : null,
|
||||
@@ -122,14 +122,14 @@ then the JSON value of `null`. For example:
|
||||
|
||||
NOTE: The JSON value of `null` is NOT enclosed in double quotes.
|
||||
|
||||
The "winning_entry_set" is an array of JSON members that indicate
|
||||
the each of the IOCCC winning entries for whom the author is the author. :-)
|
||||
The `"winning_entry_set"` is an array of JSON members that indicate
|
||||
each of the IOCCC winning entries that the author is the author of. :-)
|
||||
|
||||
```json
|
||||
{ "winner_id" : "YYYY_dirname" }
|
||||
```
|
||||
|
||||
The "YYYY_dirname" is a winner ID in JSON encoded string form.
|
||||
The `"YYYY_dirname"` is a winner ID in JSON encoded string form.
|
||||
Here "YYYY" is the IOCCC year, and "dirname" is the directory name
|
||||
of the winning entry under the given year directory.
|
||||
|
||||
@@ -146,7 +146,7 @@ For example:
|
||||
|
||||
### author_handle.json example
|
||||
|
||||
Here is a factious author_handle.json example:
|
||||
Here is a fictitious author_handle.json example:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -173,7 +173,8 @@ Here is a factious author_handle.json example:
|
||||
}
|
||||
```
|
||||
|
||||
Here is factious author_handle.json example where all entries that may be withheld, and null:
|
||||
Here is fictitious author_handle.json example where all entries that may be
|
||||
withheld are null:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -252,9 +252,9 @@ fixed he did it by adding a function called `pain()`. :-)
|
||||
clang** despite the fact it might appear to be gcc: no symlink and both gcc and
|
||||
clang exist but the gcc is clang which you'll see if you run `gcc --version`.
|
||||
|
||||
A tip and some fix methods from Cody: in the older days args to main() not given
|
||||
a type were implicit ints but when they're required to be char ** this can cause
|
||||
a problem. In some cases Cody was able to use a char * inside main() (see
|
||||
A tip and some fix methods from Cody: in the older days args not given a type
|
||||
were implicit ints but when they're required to be char ** this can cause a
|
||||
problem. In some cases Cody was able to use a char * inside main() (see
|
||||
[1989/tromp/tromp.c](1989/tromp/tromp.c) and
|
||||
[1986/holloway/holloway.c](1986/holloway) for two examples though done slightly
|
||||
differently). In other cases he was able to dereference the pointers to be used
|
||||
@@ -500,21 +500,11 @@ or any others.
|
||||
# 1987
|
||||
|
||||
## [1987/lievaart](1987/lievaart/lievaart.c) ([README.md](1987/lievaart/README.md))
|
||||
## STATUS: possible bug (possibly depending on system) - please help test and if necessary fix
|
||||
## STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
This might not work right. When [Cody Boone
|
||||
Ferguson](/winners.html#Cody_Boone_Ferguson) runs it he gets something like:
|
||||
|
||||
```sh
|
||||
$ ./lievaart
|
||||
Level:5
|
||||
You:2
|
||||
You:3
|
||||
You:^C
|
||||
```
|
||||
|
||||
However he also hasn't played Othello or if he has it was a very long time ago,
|
||||
so maybe he's doing something wrong.
|
||||
Two issues to be aware of: if you input invalid input (as in invalid characters
|
||||
like `.`) it might enter an infinite loop printing the same thing over and over.
|
||||
Also if you don't enter a valid number it will prompt you again.
|
||||
|
||||
|
||||
# 1988
|
||||
@@ -612,13 +602,9 @@ where this occurred was fixed but this one should not be fixed. Thank you.
|
||||
## [1990/westley](1990/westley/westley.c) ([README.md](1990/westley/README.md))
|
||||
## STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
This entry will crash without an arg. At this time this is not considered worth
|
||||
fixing so it should not be fixed.
|
||||
This entry will very likely crash or do something strange without an arg.
|
||||
|
||||
## STATUS: known bug - please help us fix
|
||||
|
||||
However any input not a number > 0 will make the program enter an infinite loop.
|
||||
This will be fixed in time but it's noted here for now.
|
||||
This entry will also enter an infinite loop if input is not a number > 0.
|
||||
|
||||
# 1991
|
||||
|
||||
@@ -1339,6 +1325,12 @@ There was no IOCCC in 1999.
|
||||
|
||||
# 2000
|
||||
|
||||
## [2000/dlowe](2000/dlowe/dlowe.c) ([README.md](2000/dlowe/README.md))
|
||||
## STATUS: doesn't work with some platforms - please help us fix
|
||||
|
||||
This entry crashes in macOS. This will be looked at later.
|
||||
|
||||
|
||||
[2000/primenum](2000/primenum/primenum.c) ([README.md](2000/primenum/README.md))
|
||||
## STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
@@ -1662,7 +1654,7 @@ in the process some of the generated code fails.
|
||||
|
||||
What might the translation of the comment end up being? Here's an example:
|
||||
|
||||
```
|
||||
```c
|
||||
system(" echo Line 2;sed -n -e 2,77p out> c.c;cc c.c -c ");
|
||||
```
|
||||
|
||||
@@ -1703,6 +1695,7 @@ does not exist.
|
||||
|
||||
This entry requires that `sed` and `cc` are in the path.
|
||||
|
||||
|
||||
## [2005/mynx](2005/mynx/mynx.c) ([README.md](2005/mynx/README.md))
|
||||
## STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
@@ -2089,6 +2082,15 @@ Abort trap: 6
|
||||
|
||||
but this is expected and the file `ioccc.html` will be generated properly.
|
||||
|
||||
## [2018/poikola](2018/poikola/prog.c) ([README.md](2018/poikola/README.md]))
|
||||
## STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
Some have reported that Terminal.app in macOS does not work and one might need a
|
||||
different terminal emulator like that from [XQuartz](https://www.xquartz.org)
|
||||
but [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) reported that this
|
||||
works fine in macOS Ventura with Terminal.app. YMMV of course.
|
||||
|
||||
|
||||
|
||||
# 2019
|
||||
|
||||
@@ -2112,7 +2114,7 @@ This is NOT a bug and you'll have to (at least at this time?) delete the files
|
||||
manually. You shouldn't have to worry about these being added to git: it seems
|
||||
to ignore sockets (it did at least in macOS).
|
||||
|
||||
NOTE: To get a list of files with this glob try:
|
||||
NOTE: to get a list of files with this glob try:
|
||||
|
||||
```sh
|
||||
ls -al |awk '{print $NF}' | grep -E '^\.[A-Z]+'
|
||||
|
||||
+336
-302
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user