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.
This commit is contained in:
Cody Boone Ferguson committed 2023-03-06 09:04:46 -08:00
1 parent b6be01bdc6
commit 9d63c37f49
23 files changed
+353 -280

No files matched your search

+1 -1
View File
@@ -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
+36 -22
View File
@@ -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
<space> - 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
<space> - 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
+4 -4
View File
@@ -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