diff --git a/1988/dale/README.md b/1988/dale/README.md index 40142f2be..22b06c7b1 100644 --- a/1988/dale/README.md +++ b/1988/dale/README.md @@ -38,7 +38,7 @@ behaviour? ./dale "$(printf "the following files exist in this directory:\n%s\n" *)" ``` -### Alternate code +### Alternate code: If you have an old enough compiler you can try the original version in [dale.alt.c](dale.alt.c). To use: diff --git a/1989/westley/Makefile b/1989/westley/Makefile index b7f8fffa4..fe541f499 100644 --- a/1989/westley/Makefile +++ b/1989/westley/Makefile @@ -115,8 +115,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= ver0.o ver1.o ver2.o ver3.o -ALT_TARGET= ver0 ver1 ver2 ver3 +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1989/westley/README.md b/1989/westley/README.md index 09107354b..444c18cbe 100644 --- a/1989/westley/README.md +++ b/1989/westley/README.md @@ -10,9 +10,17 @@ US\ make all ``` +### Bugs and (Mis)features + +This entry a listed in [bugs.md](/bugs.md) as: + +``` +STATUS: main() function args not allowed - please help us fix +STATUS: known bug - please help us fix +``` + +For more detailed information see [bugs.md](/bugs.md#1989westley-readmemd). -NOTE: this entry only partly works with clang and only some versions of clang, -due to defects in the compiler. See [bugs.md](/bugs.md) for more details. ## Try: @@ -51,20 +59,39 @@ Finally try: ```sh ./westley # input some lines of text, sending EOF (usually ctrl-d) to end + +echo IOCCC | ./westley +echo IOCCC | ./westley 1 +echo IOCCC | ./westley 1 2 +echo IOCCC | ./westley 1 2 3 + echo IOCCC | ./ver0 echo Version 1 | ./ver1 echo Version 2 | ./ver2 echo Version 3 | ./ver3 ``` +## Alternate code: -### INAFIAB - it's not a feature it's a bug :-( +The alternate code allows SOME of the features to work with clang but some of +the code it generates (see [compile.sh](compile.sh), which does not use this +version) is not compilable even in gcc let alone clang. Nevertheless the main +feature should work for clang. -There might have been a segfault that was fixed in the original code but as we -no longer know what condition or conditions caused this we cannot be sure. It -seems like, according to various files, that `ver1` and/or `ver2` also have this -problem but we also do not know about the status of this. See -[bugs.md](/bugs.md) for more information. +### To build: + +```sh +make alt +``` + +### Try: + +```sh +echo IOCCC | ./westley.alt +echo IOCCC | ./westley.alt 1 +echo IOCCC | ./westley.alt 1 2 +echo IOCCC | ./westley.alt 1 2 3 +``` diff --git a/1989/westley/compile.sh b/1989/westley/compile.sh index b4d497d72..1366968e9 100755 --- a/1989/westley/compile.sh +++ b/1989/westley/compile.sh @@ -13,9 +13,7 @@ # # CC=/opt/local/bin/gcc-mp-12 ./compile.sh # -# We sleep (by default) for approximately 1 second after each command so that -# the you can read what is being done. If this is too fast you can change it in -# a similar way to the above but using the variable DELAY like so: +# If you wish to slow down the script you can use the DELAY variable like: # # DELAY=2 ./compile.sh # @@ -36,11 +34,11 @@ if [[ -z "$CC" ]]; then fi # get sleep duration -# we cannot use the form '${DELAY:=5}' because at least in some versions of bash +# we cannot use the form '${DELAY:=0}' because at least in some versions of bash # it tries to invoke the command and obviously that won't work. Thus we check if # it's empty before setting the default. if [[ -z "$DELAY" ]]; then - DELAY=2 + DELAY=0 fi # make clobber to make the directory clean and then compile westley which we diff --git a/1989/westley/westley.alt.c b/1989/westley/westley.alt.c new file mode 100644 index 000000000..92cff6cd2 --- /dev/null +++ b/1989/westley/westley.alt.c @@ -0,0 +1,25 @@ + +/**//*/};)/**/main(/*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN +,ABBA(niam&&)))2-]--tang-[kri - =raeN(&&0<)/*clerk*/,noon,raeN)char +**gnat, **noon, **raeN;{int gn = gnat, ra = raeN, no = noon; (!tang&& +no!=-1&&(gn&2)&&((raeN&&( getchar(no+0)))||(1-ra&&(trgpune(no +)))))||tang&&znva(/*//**/tang ,tang,tang/**|**//*/((||)))0(enupgrt=raeN +(&&tang!(||)))0(rahcteg=raeN( &&1==tang((&&1-^)gnat=raeN(;;;)tang,gnat +,ABBA,0(avnz;)gnat:46+]552&)191+gnat([kri?0>]652%)191+gnat([kri=gnat +(&&)1-^gnat(&&)1& ABBA(!;)raeN,tang,gnat,ABBA(avnz&&0>ABBA{)raeN +,/**/);}znva(/*//**/tang,gnat,ABBA/**//*/(niam;}1-,78-,611-,321 +-,321-,001-,64-,43-,801-,001-,301-,321-,511-,53-,54,44,34,24 +,14,04,93,83,73,63,53,43,33,85,75,65,55,45,35,25,15,05,94,84 +,74,64,0,0,0,0,0,0,/**/){ABBA='N'==65;(ABBA&&(gnat=trgpune +(0)))||(!ABBA&&(gnat=getchar(0-0)));(--tang&1)&&(gnat='n'<= +gnat&&gnat<='z'||'a'<=gnat&&gnat<='m'||'N'<=gnat&&gnat<='Z' +||'A'<=gnat&&gnat<='M'?(((gnat&/*//**/31/**//*/,21,11,01,9,8 +,7,6,5,4,3,2,1,62,52,42,/**/)+12)%26)+(gnat&/*//**/32/**//*/, +22,12,02,91,81,71,61,51,41{=]652[kri};)/*pry*/)+65:gnat);main +(/*//**\**/tang^tang/**//*/,/* */,~/*//*-*/tang,gnat,ABBA- +0/**//*/(niam&&ABBA||))))tang( rahcteg&&1-1=]652%)191+gnat([kri=gnat diff --git a/1990/baruch/README.md b/1990/baruch/README.md index f8a750f1a..56c3b0dc6 100644 --- a/1990/baruch/README.md +++ b/1990/baruch/README.md @@ -1,15 +1,9 @@ # Best Small Program Baruch Nissenbaum\ -Tel-Aviv University\ -The Faculty of Engineering\ -Tel-Aviv\ Israel Doron Osovlanski\ -CADTECH - CAD/CAM Systems Ltd\ -24 Ben-Yosef St.\ -Givat-Shmuel 51905\ Israel ## To build: @@ -59,7 +53,7 @@ Use `baruch.alt` as you would `baruch`. ## Judges' remarks: -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. @@ -95,7 +89,7 @@ long enough.. ### For PC users: -In order to compile the program under Turbo-C or MSC, `'int '` should be inserted +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"`. diff --git a/1993/lmfjyh/README.md b/1993/lmfjyh/README.md index 2b532a5d1..6cc947c17 100644 --- a/1993/lmfjyh/README.md +++ b/1993/lmfjyh/README.md @@ -39,7 +39,7 @@ If you have gcc < 2.3.3 (i.e. the entry can compile): ``` -### Alternate code +### Alternate code: To use: diff --git a/1995/garry/README.md b/1995/garry/README.md index 7dc612526..fcb7aacde 100644 --- a/1995/garry/README.md +++ b/1995/garry/README.md @@ -35,13 +35,28 @@ judges noted that the C pre-processed version (with the `#include`s left intact) looked very much like a rat "dropping core". See [garry.alt.c](garry.alt.c) and judge for yourself! -To use try: +#### To build: + ```sh make alt ``` -Use `garry.alt` as you would `garry` above. +#### To use: + +```sh +./garry.alt output_file +``` + +#### Try: + +```sh + +GARRY=garry.alt ./garry.test.sh + +./garry.alt < README.md +``` + ## Judges' remarks: diff --git a/1995/garry/garry.test.sh b/1995/garry/garry.test.sh index a8b33e56d..50adf04aa 100755 --- a/1995/garry/garry.test.sh +++ b/1995/garry/garry.test.sh @@ -1,10 +1,13 @@ #!/usr/bin/env sh # -# garry.test - example of how to use garry +# garry.test.sh - example of how to use garry EXAMPLEON="\33\133\61\73\67\155" EXAMPLEOFF="\33\133\155" DOLLAR="$" export EXAMPLEON EXAMPLEOFF DOLLAR +# make sure code is built, first +make all || exit 1 + ./garry 8 have been known to cause compilers (and -in one case a system) to crash during compilation. We tested it in 2023 on a -MacBook Pro with the M1 chip and found that LEVEL > 6 caused problems. +Back in 1995, values of `LEVEL>8` caused some compilers (and in one case a +system) to crash during compilation. In 2023 with modern systems this is not +really a problem. + +Back in 1995 we also suggested that for a bad/slow time to try `LEVEL=15` but +this is not a big deal in 2023 either. -For a bad/slow time try LEVEL=15. ## Authors' remarks: diff --git a/2004/arachnid/README.md b/2004/arachnid/README.md index 7a57ff874..76cf1080f 100644 --- a/2004/arachnid/README.md +++ b/2004/arachnid/README.md @@ -36,7 +36,7 @@ QWERTY keyboards. Rogue players, vi users, and Dvorak typists are invited to get lost (or use the alt version)! -### Alternate code +### Alternate code: To use: diff --git a/2004/hoyle/README.md b/2004/hoyle/README.md index eed4d2be9..592c258d4 100644 --- a/2004/hoyle/README.md +++ b/2004/hoyle/README.md @@ -24,7 +24,7 @@ make ./hoyle 2 0 1 0 -0.001 ``` -### Alternate code +### Alternate code: An alternate version of this entry, [hoyle.alt.c](hoyle.alt.c), is provided. This alternate code has a missing newline and used a non-standard tab stop size. diff --git a/2004/kopczynski/README.md b/2004/kopczynski/README.md index fb01eb7c9..decc3c940 100644 --- a/2004/kopczynski/README.md +++ b/2004/kopczynski/README.md @@ -42,7 +42,7 @@ What happens if you feed the program source to the program? Can you figure out why? -### Alternate code +### Alternate code: The judges modified the program to print its result. The original program returned the result as an exit code: diff --git a/2012/endoh2/find-font-table.rb b/2012/endoh2/find-font-table.rb index d3b529048..95108da4d 100644 --- a/2012/endoh2/find-font-table.rb +++ b/2012/endoh2/find-font-table.rb @@ -91,5 +91,5 @@ u, v, d, s = find_params(fonts) puts "Found." puts puts "Let s = %p." % s -puts "You can get the font data of dicimal character 'n' (0--9):" +puts "You can get the font data of decimal character 'n' (0--9):" puts " %d * s[n+10] - %d * s[n] - %d" % [u, v, d] diff --git a/2012/grothe/grothe.orig.c b/2012/grothe/grothe.orig.c index 1d2c651fc..646746991 100644 --- a/2012/grothe/grothe.orig.c +++ b/2012/grothe/grothe.orig.c @@ -2,26 +2,31 @@ #include #include -int u,z,q[0400],O[0x101],o[0401],I[257],w[258][0403],W[0x100],Z[0x103],c[0403],k -,i,j,n,l,p,m;const char*J[0416],*M[0400];FILE*K[280],*s[0x102];void f(char*n,int -a){char*e=n;while(*e!='\0'){if(tolower((int)*e)!=*e)fputc(040,stderr);fputc((*e) --a,stderr);e+=1;}(void)fputc('\n',stderr);}int y(int a,int b);int t(int i,int j) -{int k=i&j,l=i^j,n,m=1;for(n=1;k>=n;n<<=1)if(k&n)m=y(m,1<1 -?y(m,1<>i;++i)for(j=0x0;b>>j;j++)if(((a>>i)&1)&&((b>>j)&1))n^=t(i,j);return w[a][b]=w[ -b][a]=n;}void a(void){for(i=0;i=toupper('0'))&&(T[k][l] -<=tolower('9'));l++){p=p*10+(T[k][l]-'0');if(p>=256)X(1,0);}if(T[k][l]=='-'){for -(m=0;m=256)X(4,0); O[z]=p;M[z]=T[k]+l+1;s[z]= -fopen(M[z],"w");if(!s[z])X(5,0);z++;}else X(6,0);}if(!(u!=0))X(7,0);if(!(z!= 0)) -X(8,0);for(i=0;i>i;++i)for(j=0x0;b>>j;j++)if(((a>>i)&1)&&((b>>j)&1))n^=x[i][j]; +return n;}static void a(void){for(i=0;i= +toupper('0'))&&(T[k][l]<=tolower('9'));l++){p=p*10+(T[k][l]-'0');if(p>=256)X(1,0 +);}if(T[k][l]=='-'){for(m=0;m=256)X(4,0);O[z] +=p;M[z]=T[k]+l+1;s[z]=fopen(M[z],"w");if(!s[z])X(5,0);z++;}else X(6,0);}if(!(u!= +0))X(7,0);if(!(z!=0))X(8,0);for(i=0;i