From 9d63c37f490da333fbb1ed7db9571902570d4bad Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 6 Mar 2023 08:52:42 -0800 Subject: [PATCH] Get 1989 entries to compile There were some which cannot be compiled under clang. One entry we used a patch from Yusuke Endoh to get the entry to compile; thank you Yusuke for your assistance! Another one we used a patch from Yusuke (thank you!) but I further fixed it so that it would work with clang. It had to be done: IOCCC Tetris has to work! This was done by changing the environment arg to main() to be a char * in main() itself rather than a char **. Using a char ** in main() third arg got it to compile but only one key worked with clang so I changed it to be not the third argument but a regular char * in main(). **a (third arg) evaluated correctly but *a[1] and onward was actually part of the environment. Again IOCCC Tetris has to work! I also fixed fubar to work which took a few tweaks. README.md files were also updated. --- 1989/fubar/Makefile | 2 - 1989/fubar/README.md | 9 ++- 1989/fubar/fubar.c | 11 +-- 1989/fubar/fubar.sh | 4 +- 1989/jar.1/Makefile | 2 + 1989/jar.1/README.md | 39 +++++----- 1989/jar.2/Makefile | 1 + 1989/jar.2/README.md | 82 +++++++++++--------- 1989/jar.2/jar.2.c | 32 ++++---- 1989/ovdluhe/Makefile | 1 - 1989/ovdluhe/README.md | 59 +++++++------- 1989/paul/Makefile | 2 +- 1989/paul/README.md | 171 ++++++++++++++++++++++------------------- 1989/robison/Makefile | 9 ++- 1989/robison/README.md | 61 +++++++++------ 1989/robison/robison.c | 2 +- 1989/roemer/README.md | 29 ++++--- 1989/tromp/Makefile | 2 +- 1989/tromp/README.md | 58 ++++++++------ 1989/tromp/tromp.c | 8 +- 1989/vanb/README.md | 40 ++++++---- 1989/westley/Makefile | 2 +- years.html | 7 ++ 23 files changed, 353 insertions(+), 280 deletions(-) diff --git a/1989/fubar/Makefile b/1989/fubar/Makefile index a7d50d5ae..cb3e1a873 100644 --- a/1989/fubar/Makefile +++ b/1989/fubar/Makefile @@ -182,7 +182,6 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: This entry is likely to fail and/or dump core on modern computers." ${RM} -f $@ ${CP} -f fubar.sh $@ ${CHMOD} +x $@ @@ -198,7 +197,6 @@ data: ${DATA} @${TRUE} ${PROG}.orig: ${PROG}.orig.c - @echo "NOTE: This entry is likely to fail and/or dump core on modern computers." ${RM} -f $@ ${CP} -f fubar.orig.sh $@ ${CHMOD} +x $@ diff --git a/1989/fubar/README.md b/1989/fubar/README.md index 041b24763..576c2e21f 100644 --- a/1989/fubar/README.md +++ b/1989/fubar/README.md @@ -17,10 +17,13 @@ ## Judges' comments - Run this with a single digit argument (or wait a long time). +Run this with a single digit argument (or wait a long time). - The blank line at the beginning of the source is mandatory. - Do you know why? +The blank line at the beginning of the source is mandatory. +Do you know why? + +With a bit of tinkering Cody Boone Ferguson got this to work on modern systems. +We thank him for his assistance! ## Author's comments diff --git a/1989/fubar/fubar.c b/1989/fubar/fubar.c index 51d90b022..136dbb394 100644 --- a/1989/fubar/fubar.c +++ b/1989/fubar/fubar.c @@ -1,19 +1,20 @@ #include +#include #define QQ 1 #define TT 1 -#define cc main(c,v) int c; char **v;{char tt[12],qq[7]; int q=0,o=1,l=1,m=1;struct {int c;} f; +#define cc int main(c,v) int c; char **v;{char tt[12],qq[7]; int q=0,o=1,l=1,m=1;struct {int c;} f; #define ouroboros qq[6]='\0';tt[11]='\0';if(QQ==atoi(v[1])+1){(void)fprintf(stderr,"%s factorial = %d\n",v[1], TT);exit(1);}o=c+f #define x ;while(EOF!=(o=getchar())){if(l && q=='Q' && o=='Q'){l=0;(void)getchar();(void)fread(qq,6,1,stdin);(void)printf("Q %6d",atoi(qq)+1);}else if(m && q=='T' && o=='T'){m=0;(void)fread(tt,11,1,stdin);(void)printf("T %9d\n",atoi(tt)*QQ);}else {q=o;(void)putchar(o);}}exit(0);} cc ouroboros.c -o x #define zxc ;{/* -cat ouroboros.c | x $1 > x1 +cat ./ouroboros.c | ./x $1 > x1 if [ $? -ne 0 ]; then exit fi -mv x1 ouroboros.c -chmod +x ouroboros.c -exec ouroboros.c $1 +mv x1 ./ouroboros.c +chmod +x ./ouroboros.c +exec ./ouroboros.c $1 exit */ diff --git a/1989/fubar/fubar.sh b/1989/fubar/fubar.sh index 248fd09aa..abb4b0ae5 100755 --- a/1989/fubar/fubar.sh +++ b/1989/fubar/fubar.sh @@ -11,9 +11,9 @@ fi rm -f ouroboros.c x1 x ex - < -#a -#a -#d p char* -#d P ,(p) -#d T(E) !strcmp(E,"()") -#d U return -#d W while -#d X sbrk(199) -#d z atof -#d e isspace -#d D A(_) -#d E S(C(_)) -#d B(y) p y(_)p _;{ -#d G(y,V) B(y)p i;U sprintf(i=X,"%lf",z(E)V z(S(C(D)))),i;} +#include +#include +#include +#define p char* +#define P ,(p) +#define T(E) !strcmp(E,"()") +#define U return +#define W while +#define X sbrk(199) +#define z atof +#define e isspace +#define D A(_) +#define E S(C(_)) +#define B(y) p y(_)p _;{ +#define G(y,V) B(y)p i;U sprintf(i=X,"%lf",z(E)V z(S(C(D)))),i;} p sbrk(),*S(),*j(),*O,*H;K,Y,M=14;double z();Q(_)p _;{int V=0;W(e(*_))_++;H=_;W(V|!(e diff --git a/1989/ovdluhe/Makefile b/1989/ovdluhe/Makefile index 2c2a6ca51..5df100bdf 100644 --- a/1989/ovdluhe/Makefile +++ b/1989/ovdluhe/Makefile @@ -186,7 +186,6 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: This entry requires a non-standard K&R C compiler to compile." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1989/ovdluhe/README.md b/1989/ovdluhe/README.md index 0d110e5ae..c8a08b116 100644 --- a/1989/ovdluhe/README.md +++ b/1989/ovdluhe/README.md @@ -1,4 +1,4 @@ -Most humorous output: +## Most humorous output: Oskar von der Luehe Institut fuer Astronomie @@ -6,40 +6,45 @@ Most humorous output: 8092 Zuerich Switzerland -Judges notes: +## To build: - Run this program using your favorite text file as input. Files - such as mailboxes, man pages and usenet articles are especially - recommended. You will get different output each time you run it. + make all - Run the program this way: +To get this to compile with a modern CPP, we had to replace `#D` with `#define`. - ovdluhe < textfile +## Judges' comments: - The program stops when it reaches the end of the template buffer - by chance or is killed. +Run this program using your favorite text file as input. Files +such as mailboxes, man pages and usenet articles are especially +recommended. You will get different output each time you run it. - To have a chance to compile under a modern CPP, we had to - replace `#D` with `#define`. +Run the program this way: -Selected notes from the author: + ovdluhe < textfile - This program implements an "Eddington ape" - it generates - random text from a supplied template. The template text file - is read through stdin. The larger the template, the better the - result. A maximum of 2**12 chars are used. From the template, - the program calculates the statistics of chars that immediately - follow a given string (correlator string) of a certain length - (currently 4 - can be varied by changing the definition for P - accordingly). A character is randomly chosen, weighted by its - probability to occur after the correlator string. That - character is printed to stdout and placed at the end of the - correlator string, whose first character is discarded. - Meaningful words are therefore usually preserved, the effect on - sentences can be dramatically random. +The program stops when it reaches the end of the template buffer +by chance or is killed. - You might want to vary the definition of P between 2 and 10 and - observe the result. + + +## Selected notes from the author: + +This program implements an "Eddington ape" - it generates +random text from a supplied template. The template text file +is read through stdin. The larger the template, the better the +result. A maximum of `2**12` chars are used. From the template, +the program calculates the statistics of chars that immediately +follow a given string (correlator string) of a certain length +(currently 4 - can be varied by changing the definition for P +accordingly). A character is randomly chosen, weighted by its +probability to occur after the correlator string. That +character is printed to stdout and placed at the end of the +correlator string, whose first character is discarded. +Meaningful words are therefore usually preserved, the effect on +sentences can be dramatically random. + +You might want to vary the definition of P between 2 and 10 and +observe the result. Copyright (c) 1989, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1989/paul/Makefile b/1989/paul/Makefile index b0742abf5..8c355f29a 100644 --- a/1989/paul/Makefile +++ b/1989/paul/Makefile @@ -185,7 +185,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: This entry is likely to fail and/or dump core on modern computers." + @echo "NOTE: this entry will likely dump core with arm64 chips." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1989/paul/README.md b/1989/paul/README.md index 0e65d3c0c..5c4408ef9 100644 --- a/1989/paul/README.md +++ b/1989/paul/README.md @@ -1,4 +1,4 @@ -Most complex algorithm: +## Most complex algorithm: Paul E. Black CIRRUS LOGIC, Inc. @@ -7,100 +7,109 @@ Most complex algorithm: 95035 USA -Judges notes: +## To build: - The original source contained a long line which caused many - mailers to barf. The original file may be re-constructed by - removeing the trailing "\" on line 12 and joining lines 12 and - 13 together without a space. + make all - WHAT FOLLOWS IS A DETAILED PROGRAM EXPLINATION AND SPOILER. - IF YOU WANT A REAL CHALLENGE, DON'T READ ANY FURTHER AND TRY - TO UNDERSTAND THE PROGRAM VIA THE SOURCE. +NOTE: this entry will likely dump core with arm64 chips. We could get it to work +with modern systems with x86_64 but systems but we at least with macOS arm64 +this program dumps core. We could not test Intel Macs. + + +## Judges' comments: + +The original source contained a long line which caused many +mailers to barf. The original file may be re-constructed by +removing the trailing "\" on line 12 and joining lines 12 and +13 together without a space. + +WHAT FOLLOWS IS A DETAILED PROGRAM EXPLANATION AND SPOILER. +IF YOU WANT A REAL CHALLENGE, DON'T READ ANY FURTHER AND TRY +TO UNDERSTAND THE PROGRAM VIA THE SOURCE. Selected notes from the author: - This programs computes and prints Fibonacci numbers by - simulating a Turing machine with the proper program. - Understanding the C program, i.e., a Turing machine simulator, - is only the first and simplest step. The Turing machine - program must be understood, too! (it is trivial, perhaps even - natural to write incredibly obscure Turing programs.) +This programs computes and prints Fibonacci numbers by +simulating a Turing machine with the proper program. +Understanding the C program, i.e., a Turing machine simulator, +is only the first and simplest step. The Turing machine +program must be understood, too! (it is trivial, perhaps even +natural to write incredibly obscure Turing programs.) - If the program is invoked with an operand, the operand is used - as the Turing program. It includes a "trace" facility, - subroutine r (commented out for obscurity), to help write and - debug Turing programs. Just the thing for some fun in a Theory - of Computation class. +If the program is invoked with an operand, the operand is used +as the Turing program. It includes a "trace" facility, +subroutine r (commented out for obscurity), to help write and +debug Turing programs. Just the thing for some fun in a Theory +of Computation class. - The Turing machine tape is represented as a doubly linked list - of pointers. The forward and backward links are XOR'd together - and stored in one pointer. If we always keep one of the links - on hand, we can recover the other link at any time. The - variable q is the scan head (and a pointer at some tape cell), - and p is a "previous" link. The state of the tape is stored in - the low order bit of the pointer. Since we always allocate an - even number of bytes, the low order bit carries no information - (see portability below.) Memory representing a tape cell is - allocated when the cell is first scanned. Thus the simulation - begins with a tape effectively the size of virtual memory set - to all zeros. Since a header can be added to any Turing - program to write initial data and position the scan head, this - is little loss of generality. +The Turing machine tape is represented as a doubly linked list +of pointers. The forward and backward links are XOR'd together +and stored in one pointer. If we always keep one of the links +on hand, we can recover the other link at any time. The +variable q is the scan head (and a pointer at some tape cell), +and p is a "previous" link. The state of the tape is stored in +the low order bit of the pointer. Since we always allocate an +even number of bytes, the low order bit carries no information +(see portability below.) Memory representing a tape cell is +allocated when the cell is first scanned. Thus the simulation +begins with a tape effectively the size of virtual memory set +to all zeros. Since a header can be added to any Turing +program to write initial data and position the scan head, this +is little loss of generality. - The simulated Turing machine has a single tape with either an 1 - or a 0 in each cell. The Turing machine language format is a - string of three bytes. The first byte is the current state. - The second byte is the next state. (The last bit of states is - ignored, e.g., B and C are the same state, in an attempt to be - able to have interesting words in the program.) The third byte - is composed of bits. Bit 1 (2&byte) is the symbol scanned, - i.e. an instruction is selected for state and for a match with - the symbol under the scan head. Bit 2 (4&byte) is the new - symbol to be written to the cell. Bit 3 (8&byte) is the - direction to move the scan head: 0 for left and 1 for right. - If bit 4 (16&byte) is true, the next character is sent to - stdout. (I added this feature so programs could print - results.) +The simulated Turing machine has a single tape with either an 1 +or a 0 in each cell. The Turing machine language format is a +string of three bytes. The first byte is the current state. +The second byte is the next state. (The last bit of states is +ignored, e.g., B and C are the same state, in an attempt to be +able to have interesting words in the program.) The third byte +is composed of bits. Bit 1 (2&byte) is the symbol scanned, +i.e. an instruction is selected for state and for a match with +the symbol under the scan head. Bit 2 (4&byte) is the new +symbol to be written to the cell. Bit 3 (8&byte) is the +direction to move the scan head: 0 for left and 1 for right. +If bit 4 (16&byte) is true, the next character is sent to +stdout. (I added this feature so programs could print +results.) - The Turing machine has next state 'j' when it begins. The - cycle is 1) exit if the state is 'x', 2) find the next - instruction (given the state and the character under the scan - head). [The program string is searched forward for the next - matching instruction. If the end of the string is reached, the - search begins again at the first of the string. Thus states - can be used as local labels in different places.] 3) change to - the next state, 4) print a character if indicated, 5) write the - tape symbol, and 6) move the scan head. The cycle then repeats - with step 1. A call to the trace routine is just before step - 2, but is commented out. +The Turing machine has next state 'j' when it begins. The +cycle is 1) exit if the state is 'x', 2) find the next +instruction (given the state and the character under the scan +head). [The program string is searched forward for the next +matching instruction. If the end of the string is reached, the +search begins again at the first of the string. Thus states +can be used as local labels in different places.] 3) change to +the next state, 4) print a character if indicated, 5) write the +tape symbol, and 6) move the scan head. The cycle then repeats +with step 1. A call to the trace routine is just before step +2, but is commented out. - The following ROT13'ed text is a quick outline of the actual - Turing program: +The following ROT13'ed text is a quick outline of the actual +Turing program: - Urer vf n dhvpx bhgyvar bs gur Ghevat cebtenz: gur - cerivbhf naq pheerag Svobanppv ahzoref ner xrcg va onfr - 1 sbez jvgu gur pheerag ba gur evtug. Gur svefg guerr - fgrcf frg hc gur svefg gjb ahzoref, 1 naq 1. Gura - [ortvaavat jvgu "@ ("] n znexre bs VVV vf perngrq naq - gur pheerag ahzore vf pbcvrq gb gur evtug bs gur - znexre. Gura [ortvaavat jvgu "BI "] gur ahzore vf - pbairegrq gb ovanel ol ercrngrq qvivqvat ol 2 yrnivat V - sbe erznvaqre 1, naq VV sbe erznvaqre 0. Arkg - [ortvaavat jvgu "JI "] gur ovanel ercerfragngvba vf - cevagrq naq vgf flzobyf naq gur znexre ner renfrq. - Svanyyl [ortvaavat jvgu "RRa"] gur gjb ahzoref ner - nqqrq naq gur pheerag ahzore pbcvrq gb gur yrsg gb - orpbzr gur cerivbhf. Gura gur plpyr ercrngf. + Urer vf n dhvpx bhgyvar bs gur Ghevat cebtenz: gur + cerivbhf naq pheerag Svobanppv ahzoref ner xrcg va onfr + 1 sbez jvgu gur pheerag ba gur evtug. Gur svefg guerr + fgrcf frg hc gur svefg gjb ahzoref, 1 naq 1. Gura + [ortvaavat jvgu "@ ("] n znexre bs VVV vf perngrq naq + gur pheerag ahzore vf pbcvrq gb gur evtug bs gur + znexre. Gura [ortvaavat jvgu "BI "] gur ahzore vf + pbairegrq gb ovanel ol ercrngrq qvivqvat ol 2 yrnivat V + sbe erznvaqre 1, naq VV sbe erznvaqre 0. Arkg + [ortvaavat jvgu "JI "] gur ovanel ercerfragngvba vf + cevagrq naq vgf flzobyf naq gur znexre ner renfrq. + Svanyyl [ortvaavat jvgu "RRa"] gur gjb ahzoref ner + nqqrq naq gur pheerag ahzore pbcvrq gb gur yrsg gb + orpbzr gur cerivbhf. Gura gur plpyr ercrngf. - The program requires that the lowest bit of a pointer to be 0. +The program requires that the lowest bit of a pointer to be 0. - I could have squeezed the program under 1024 bytes without the - trace subroutine, but I felt it was important for understanding - the program. Besides it is fun to watch the tape zooming back - and forth as the program runs. A much better debugger or trace - could easily be added. +I could have squeezed the program under 1024 bytes without the +trace subroutine, but I felt it was important for understanding +the program. Besides it is fun to watch the tape zooming back +and forth as the program runs. A much better debugger or trace +could easily be added. Copyright (c) 1989, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1989/robison/Makefile b/1989/robison/Makefile index 3858c79d1..8f16c9b99 100644 --- a/1989/robison/Makefile +++ b/1989/robison/Makefile @@ -121,6 +121,13 @@ OPT= -O3 # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} +# FORCE use of -include stdlib.h +# +CFLAGS+= -include stdlib.h + + +## FORCE + # Libraries needed to build # LIBS= @@ -183,7 +190,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: This entry requires a non-standard K&R C compiler to compile." + @echo "NOTE: This entry will likely dump core on invalid input." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1989/robison/README.md b/1989/robison/README.md index e044ce8bc..7f085447c 100644 --- a/1989/robison/README.md +++ b/1989/robison/README.md @@ -1,4 +1,4 @@ -Best minimal use of C: +## Best minimal use of C: Arch D. Robison University of Illinois @@ -7,42 +7,53 @@ Best minimal use of C: 61801 USA -Judges notes: +## To build: - Sites with punch card facilities will be happy to note that - the source deck can be re-collated with an ASCII sort. + make all - Note that this program uses only a small subset of the - constructs that the C language supports. -Selected notes from the author: +NOTE: we were able to get this to compile under modern systems with a patch from +Yusuke Endoh. Thank you for your assistance Yusuke! - This program is a handy picoAPL interpreter written in C--. It - outputs the evaluation of an APL expression from standard - input. Functions are limited to dyadic +,-,x, and unary -; - numerals must be binary. Parentheses may be used for - grouping. For example: +## Judges' comments: + +Sites with punch card facilities will be happy to note that +the source deck can be re-collated with an ASCII sort. + +Note that this program uses only a small subset of the +constructs that the C language supports. + +NOTE: this entry will likely dump core with invalid input. + + +## Selected notes from the author: + +This program is a handy picoAPL interpreter written in C--. It +outputs the evaluation of an APL expression from standard +input. Functions are limited to dyadic +,-,x, and unary -; +numerals must be binary. Parentheses may be used for +grouping. For example: 101x111-100 - prints: +prints: 1111 - That is 5x(7-4) is 15. (APL groups from right to left.) - Extending it to the full APL language should be trivial. +That is 5x(7-4) is 15. (APL groups from right to left.) +Extending it to the full APL language should be trivial. - The C-- language improves the C language by removing superfluous - and confusing features: arithmetic, logical operations, shifts, - relationals, address-of, and flow control. In fact, the only - expressions retained are function calls, indirection, array - assignments, the ',' operator, and sizeof. Despite these - restrictions, the C-- program does arithmetic on arbitrarily - large binary numbers. +The C-- language improves the C language by removing superfluous +and confusing features: arithmetic, logical operations, shifts, +relationals, address-of, and flow control. In fact, the only +expressions retained are function calls, indirection, array +assignments, the ',' operator, and sizeof. Despite these +restrictions, the C-- program does arithmetic on arbitrarily +large binary numbers. - To obtain a C-- reference, simply rip out the irrelevant pages - from your K&R C manual. To obtain a C-- compiler, simply rip - out the irrelevant bytes from your cc compiler. +To obtain a C-- reference, simply rip out the irrelevant pages +from your K&R C manual. To obtain a C-- compiler, simply rip +out the irrelevant bytes from your cc compiler. Copyright (c) 1989, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1989/robison/robison.c b/1989/robison/robison.c index 3a3a72cb0..7b66a916d 100644 --- a/1989/robison/robison.c +++ b/1989/robison/robison.c @@ -6,7 +6,7 @@ #define Y(_,A)B _(d,e)B d,e;X(A) #define Z(P)C P(f,g,h,i)C f,g,h,i;X(P) #define c(_)(b=(B)malloc(sizeof(*b)),b->d=_,b->e=d,b) -#define _(D,E,F,G,H)B D();Y(D/**/f,E)Y(D/**/g,F)Y(D/**/h,G)Y(D/**/i,H)Y(D,(*(*d->d)(D/**/f,D/**/g,D/**/h,D/**/i))(d,e)) +#define _(D,E,F,G,H)B D();Y(D##f,E)Y(D##g,F)Y(D##h,G)Y(D##i,H)Y(D,(*(*d->d)(D##f,D##g,D##h,D##i))(d,e)) Z(f) Z(g) Z(h) diff --git a/1989/roemer/README.md b/1989/roemer/README.md index 9f3eea6d0..9d1bf0d8c 100644 --- a/1989/roemer/README.md +++ b/1989/roemer/README.md @@ -1,4 +1,4 @@ -Best layout: +## Best layout: Lievaart, Roemer B. VU-Informatica, Amsterdam @@ -6,21 +6,26 @@ Best layout: NL 1091 TJ Amsterdam Netherlands -Judges notes: +## To build: - Do you know what this program does? If you do, look again, - there is more here than meets the PI. + make all -Selected notes from the author: +## Judges' comments: - Passes lint, but not with the strictest options, for it - contains some "null-statements", as well two identifiers - which are, if compilers only take 6 characters, the same. It - also uses write(2), so not totally system independent. +Do you know what this program does? If you do, look again, +there is more here than meets the PI. + +## Selected notes from the author: + +Passes lint, but not with the strictest options, for it +contains some "null-statements", as well two identifiers +which are, if compilers only take 6 characters, the same. It +also uses write(2), so not totally system independent. + +You are very much invited to pass this program through a +C-beautifier. (First strip newlines and tabs, if your cb can't +do that.) - You are very much invited to pass this program through a - C-beautifier. (First strip newlines and tabs, if your cb can't - do that.) Copyright (c) 1989, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1989/tromp/Makefile b/1989/tromp/Makefile index 53479b1fb..854e1e651 100644 --- a/1989/tromp/Makefile +++ b/1989/tromp/Makefile @@ -186,7 +186,7 @@ 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 modern compilers." + @echo "NOTE: this entry uses a non-standard arg to main() that will not work some modern compilers." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1989/tromp/README.md b/1989/tromp/README.md index 015473b6d..738d50239 100644 --- a/1989/tromp/README.md +++ b/1989/tromp/README.md @@ -10,37 +10,51 @@ make all - NOTE: This entry might not compile when using modern compilers. +NOTE: we used a patch from Yusuke Endoh to get this to compile under gcc. Thank +you Yusuke for your assistance! Cody Boone Ferguson got this to work with clang +by further changing the variable `a` to be not the third argument to `main()` to +a variable declared in `main()`. We thank you for your assistance Cody (he +cynically notes that he did it because tetris just has to work)! + ### To run ./tromp [drops_per_sec [cmd_string]] +NOTE: after this game is finished you will likely get an error along the lines +of: + + Segmentation fault: 11 + stty: stdin isn't a terminal + + +and a file `HI` will be in the directory. + ## Judges' comments - This is a character terminal version of the TETRIS program. - It runs on a VT100 compatible terminal or emulator. It is - best used at 4800 baud or more. - - By default, "drops_per_sec", the number of times an object - will drop in a second, is 2. The default "cmd_string" is - "jkl pq". The first 6 characters of "cmd_string" relate - to the following 6 game commands: +This is a character terminal version of the TETRIS program. +It runs on a VT100 compatible terminal or emulator. It is +best used at 4800 baud or more. - j - left - k - rotate - l - right - - drop - p - pause - q - quit - - Specifying "cmd_string" allows one to re-define the commands. - The pause command pauses the game, clears the screen and - prints the current score. To un-pause, type the pause - character again, which by default is "p". +By default, "drops_per_sec", the number of times an object +will drop in a second, is 2. The default "cmd_string" is +"jkl pq". The first 6 characters of "cmd_string" relate +to the following 6 game commands: - As was stated last year, we are likely to be more strict about - portability in the future. [ We mean it this time :-) ] + j - left + k - rotate + l - right + - drop + p - pause + q - quit + +Specifying "cmd_string" allows one to re-define the commands. +The pause command pauses the game, clears the screen and +prints the current score. To un-pause, type the pause +character again, which by default is "p". + +As was stated last year, we are likely to be more strict about +portability in the future. [ We mean it this time :-) ] ## Author's comments diff --git a/1989/tromp/tromp.c b/1989/tromp/tromp.c index 9285810f5..52630ebe6 100644 --- a/1989/tromp/tromp.c +++ b/1989/tromp/tromp.c @@ -1,13 +1,13 @@ -long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K +long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}long c,d,l,v[]={0,0,2},w,s,I,K =0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1, 12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12, 1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12, 12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i<264;)if((k=q[i])-Q[i] ){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf( "\033[%dm "+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+ -n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V,a)char* -*V,*a;{h[3]=1000000/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i< -25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigvec(14,v, +n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V)char** +V;{char *a;*v=(long)t;h[3]=1000000/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i< +25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigaction(14,v, 0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+ 12))x+=12;else{g(7);++w;for(j=0;j<252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){ for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c diff --git a/1989/vanb/README.md b/1989/vanb/README.md index ec50b14d7..9f44e142d 100644 --- a/1989/vanb/README.md +++ b/1989/vanb/README.md @@ -1,4 +1,4 @@ -Best one liner: +## Best one liner: David Van Brackle Department of Computer Science @@ -7,31 +7,37 @@ Best one liner: 32816 USA -Judges notes: - This program computes all proper subsets of the set of - arguments passed to it. Each subset is printed with one - element on each line, followed by a line of ten dashes. +## To build: - Try: + make all - vanb the rug gary lent - vanb unix is better than os/2 +## Try: -Selected notes from the author: + ./vanb the rug gary lent + ./vanb unix is better than os/2 - The program has the following charming and possibly - non-portable features: +## Judges' comments: - * It has no local or global variables, - only the command-line parameters. +This program computes all proper subsets of the set of +arguments passed to it. Each subset is printed with one +element on each line, followed by a line of ten dashes. - * It calls main recursively. - * It alters the command-line parameters. - * It uses the fact that if the high bit is set in a character - variable, the value is negative. +## Selected notes from the author: + +The program has the following charming and possibly +non-portable features: + +* It has no local or global variables, only the command-line parameters. + +* It calls main recursively. + +* It alters the command-line parameters. + +* It uses the fact that if the high bit is set in a character variable, the +value is negative. Copyright (c) 1989, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1989/westley/Makefile b/1989/westley/Makefile index e35a05918..406456416 100644 --- a/1989/westley/Makefile +++ b/1989/westley/Makefile @@ -184,7 +184,7 @@ 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 modern compilers." + @echo "NOTE: This entry uses non-standard args to main() that do not work with some modern compilers." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/years.html b/years.html index 2779190f4..07c62494e 100644 --- a/years.html +++ b/years.html @@ -3093,6 +3093,13 @@ a window manager that does not obscure the root window.
  • Makefile
  • tromp.bsd.c
  • tromp.s5.c +
  • Yusuke Endoh provided a patch to get +this to compile with modern compilers. +Cody Boone Ferguson fixed this so +it will compile and work under clang ('IOCCC Tetris must work!'). Thank you Yusuke and +Cody!
  • + +

    vanb - one-liner prints all subsets of arguments