diff --git a/1991/buzzard/Makefile b/1991/buzzard/Makefile index 1fb48fa48..ccb1632c6 100644 --- a/1991/buzzard/Makefile +++ b/1991/buzzard/Makefile @@ -116,8 +116,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1991/buzzard/README.md b/1991/buzzard/README.md index 3b46bb169..5f882077e 100644 --- a/1991/buzzard/README.md +++ b/1991/buzzard/README.md @@ -4,6 +4,21 @@ make all ``` +There is an [alternate version](#alternate-code) which might feel more at home +for vi(m) users in navigation. + + +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: INABIAF - please **DO NOT** fix +``` + +For more detailed information see [1991 buzzard in +bugs.md](/bugs.md#1991-buzzard). + ## To use: @@ -11,6 +26,26 @@ make all ./buzzard ``` +## Alternate code: + +This version changes the keys `f` for forward, `l` for left and `r` for right to +`k` for forward, `l` for right and `h` for left, which is more natural for those +who use vi(m). + + +### Alternate build: + +```sh +make alt +``` + + +### Alternate use: + +```sh +./buzzard.alt +``` + ## Judges' remarks: @@ -21,13 +56,13 @@ You are invited to try to cheat, ... if you can figure out how! :-) ## Author's remarks: + ### How to play -When the game starts, you are at the far end of the maze from the -exit, looking down a corridor. To move forward, type `f` and press -return. To turn 90 degrees right, type `r`; left, `l`. You can -put multiple commands on one line, and the new view will be drawn -after all the moves. +When the game starts, you are at the far end of the maze from the exit, looking +down a corridor. To move forward, type `f` and press return. To turn 90 +degrees right, type `r`; and for left, `l`. You can put multiple commands on +one line, and the new view will be drawn after all the moves. The game ends if you get out the exit (you'll know it when you see it) or when you type `^D` (EOF). @@ -51,10 +86,14 @@ separate physical rows in the maze; a space indicates a corridor, and any other character is a wall. Tabs are also considered walls, so make sure to convert tabs to spaces before using it. -Usage: buzzard [filename [escape-char [start-x start-yNNN +Usage: + +```sh +./buzzard [filename [escape-char [start-x start-yNNN +``` Filename is the name of the file containing the maze. This -defaults to 'buzzard.c'. +defaults to `buzzard.c` or rather `__FILE__`. Escape-char is the character in the maze that represents the exit. You can put more than one exit in the maze (for example, you could @@ -67,7 +106,7 @@ from 0. The default is start-x = 4, start-y = 5, which is needed for the buzzard.c, but would probably be inappropriate for other mazes. -BUGS: +### BUGS: You can't change that at start you're facing down ("south"). diff --git a/1991/buzzard/buzzard.c b/1991/buzzard/buzzard.c index 6b611c6d7..c2b28a2d6 100644 --- a/1991/buzzard/buzzard.c +++ b/1991/buzzard/buzzard.c @@ -1,7 +1,7 @@ #include #define X(s) (!(s&3)-((s&3)==2)) #define W while -char Z[82][82],A,B,f,g=26;z(q){return atoi(q);}m(d,l){return +char Z[82][82],A,B,f,g=26;z(q)char**q;{return atoi(q);}m(d,l){return Z[ B + X ( f + 3) * d+l *X(f+ 2 )][ A+X ( f ) * d + l* X ( f + 3 ) ] ;}int @@ -10,7 +10,7 @@ h= 0;D(p,s)char*s; {W(h>>3

> 3 ) {putchar('\t' )&~7 ;}W(h < p ){putchar(' ');++h; }(void)printf( "%s" , s ) ;h+=strlen(s);}main(x,a)char **a; { # define P(x) (x?(5-(x))*(6-(x ))/2:11) -int b; { char b[256],i, j=0; FILE*F;F=fopen(x-1?a[1]:"buzzard.c","r");W( +int b; { char b[256],i, j=0; FILE*F;F=fopen(x-1?a[1]:__FILE__,"r");W( fgets( b ,256 ,F)){for(i=0;b[ i];++ i) Z[j][i ] =( b [ i ] ==' '?1:2*(b[i]==(x>2?*a[2]:'\\')));++j;}fclose (F);}A =4 ; B = 3 ; f = 1;x >3? A=z(a[3]),B=z(a[4]):0;b='\n';do{if(b=='\n' diff --git a/bugs.md b/bugs.md index 86c326162..929a8af35 100644 --- a/bugs.md +++ b/bugs.md @@ -677,6 +677,18 @@ where this occurred was fixed but this one should not be fixed. Thank you. # 1991 +## 1991 buzzard + +### STATUS: INABIAF - please **DO NOT** fix +### Source code: [1991/buzzard/buzzard.c](1991/buzzard/buzzard.c) +### Information: [1991/buzzard/README.md](1991/buzzard/README.md) + +If the maze file cannot be opened, either because the path specified does not +exist or because the default (whatever the source file was at compilation time) +file does not exist in the directory, this program will very likely crash. + +This is a feature, not a bug. + ## 1991 westley diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 28fbe80f5..44be2c6eb 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1097,6 +1097,22 @@ Later on, Cody added back the macro `#define D define` to make it look ever so slightly more like the original, even though it's unused. +## [1991/buzzard](1991/buzzard/buzzard.c) ([README.md](1991/buzzard/README.md])) + +Cody fixed this so that the coordinates being specified would not crash the +program. This happened because the function that calls `atoi(3)` took an arg +without any type specified and as an implicit int it was not a `char *` which +crashed the program in modern systems. + +Cody also made the file name in the code (which is the default maze file) not +hard-coded but instead be `__FILE__`. + +Finally Cody added the [alternate +version](1991/buzzard/README.md#alternate-code) which will possibly feel more at +home with those familiar with vi(m) (it certainly does feel more at home with +him): `k` for forward, `h` for left and `l` for right. + + ## [1991/dds](1991/dds/dds.c) ([README.md](1991/dds/README.md])) Cody fixed a segfault that prevented this entry from working in any condition