diff --git a/1993/rince/.gitignore b/1993/rince/.gitignore index 7b03e212b..70de81aee 100644 --- a/1993/rince/.gitignore +++ b/1993/rince/.gitignore @@ -1,4 +1,5 @@ jkb rince rince.orig +rince.alt prog.orig diff --git a/1993/rince/Makefile b/1993/rince/Makefile index 3a8cd3e71..c8c32af76 100644 --- a/1993/rince/Makefile +++ b/1993/rince/Makefile @@ -58,7 +58,7 @@ ARCH= # Defines that are needed to compile # -CDEFINE= +CDEFINE= -DZ=17 # Include files that are needed to compile # @@ -115,8 +115,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1993/rince/README.md b/1993/rince/README.md index df6b21999..fccb1a902 100644 --- a/1993/rince/README.md +++ b/1993/rince/README.md @@ -1,9 +1,6 @@ # Most Well Rounded James Bonfield -MRC Laboratory of Molecular Biology, -Hills Road -Cambridge England @@ -13,6 +10,8 @@ England make all ``` +NOTE: there is an alternate version of this program that allows one to slow down +the game. See the Alternate code section below. ## To run: @@ -21,12 +20,39 @@ make all ``` where: - + `[cabbage]` is a CABBAGE description file (default: `rince.c`) +### Alternate code: slowing down the game + +Some people may want to slow down the game by increasing the +value 17 in the lines: + + +```c +struct timeval v= {0,1<<17} ; +``` + +and + +```c +refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0; +``` + +to another value like 18 or 19. You can do this via the alternate code like: + + +```sh +make CDEFINE="-DZ=18" clobber alt +``` + +Replace 18 with whatever number you wish. + +Use `rince.alt` as you would `rince` above. + ## Judges' remarks: - + The author has provided several CABBAGE files for your amusement: - [rince.data1](rince.data1) plays @@ -72,7 +98,7 @@ should be replaced with: ```c select(k,&y,0,0,(v.tv_usec=1< +< # > v +< < +< > > < v +X X j +x X j +X x ^ k +^ ^ +^ # +X X X X + +^ v +v v +v # +v X +v x +> # < v +> > +X X l +x X l + +41 20 +######################################## +# # +# < < < < <> < < < # +# > > > <> > > > > # +# < < < < <> < < < # +# > > > <> > > > > # +# < < < < <> < < < # +# > > > <> > > > > # +# # +# # +# # +# # +# # +# # +# # +# # +# # +# # +# X # +########################################*/ +#include +#include +#include +#include +#include +int _tty_ch; +bool _echoit; +bool _rawmode; +int _tty; +#define U char +#define G for( +#define I )malloc(sizeof( + +typedef struct z {U x[20]; struct z*y; } j; j*J[2][256]; +struct timeval v= {0,1<y) { + U*f=t->x; + if (d==f[17]|f[17]==c) { + int i=k&2,u=9,k=1,w=x,_=y,T; + G; + --u||(d-f[8]&&(X[y][x]=f[8]),w---_--,i=0,u=8,k--);) { + _+=P[T=i>u?u:i]-'o'; + w+=P[4+T]-'p'; + if(k) { + if (d-f[i]&&f[i]-X[_][w]) break; + i++; + } else + f[++i+8]-d && (X[_][w]=f[i+8]); +} } } } } } + +jmp_buf E; + +int main(int open, U**exit) { + FILE*C=fopen ( + open-2?__FILE__:*++exit,P+8); + j*t; + volatile int Q,Y=0; + int i,q; d=open-2?'\t':'*'; L: + + Q=0; G; setjmp(E)<256; Q-- + ) + longjmp(E,(J[Y][Q]=0,Q++)); + G; ; ) { + if(!C)return 1; + if('\n'==(c=getc(C))) + if(!Y++)goto L; else + { fscanf(C,"%d %d\n",&i,&q); + X=(U**I P++)*q*(i+1)); + Q=0; G; Qy=J[Y][c]; J[Y][c]=t; + fgets(t->x,20,C); } +} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index b8dacf403..f1dec0627 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -384,7 +384,8 @@ compilers to compile the code, based on the author's remarks. ## [1990/cmills](1990/cmills/cmills.c) ([README.md](1990/cmills/README.md])) -Yusuke got this to work in modern systems (it resulted in a bus error). +Yusuke got this to work in modern systems (it previously resulted in a bus +error). To prevent alarming warnings at linking or runtime Cody made the entry use `fgets()` rather than `gets()`. He notes that another option would have been to @@ -626,7 +627,7 @@ NOTE: as noted in the README.md file and the [bugs.md](/bugs.md), this program a world](https://en.wikipedia.org/wiki/Earth) or just the [USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough args (2). And not that we need the help or anything for this :-) but we do -encourage you to test this :-) This should not be fixed. +encourage you to test this :-) This should NOT be fixed. ## [1993/jonth](1993/jonth/jonth.c) ([README.md](1993/jonth/README.md])) @@ -670,6 +671,10 @@ README.md files for details. Yusuke supplied a patch to get this to work in modern systems. +Cody provided an alternate version to simplify slowing the game down. This was +based on our suggestion that it might be desired to slow down but done in a way +that makes it easy to configure at compile time. See the README.md for details. + ## [1993/schnitzi](1993/schnitzi/schnitzi.c) ([README.md](1993/schnitzi/README.md]))