diff --git a/1993/plummer/README.md b/1993/plummer/README.md index ab006fb50..26de8dda2 100644 --- a/1993/plummer/README.md +++ b/1993/plummer/README.md @@ -4,6 +4,8 @@ make all ``` +There is an [alternate version](#alternate-code) that lets you slow down the +output of the program for modern systems. ## To use: @@ -16,7 +18,6 @@ where: - number is a number (try 21701) - arg is any argument -NOTE: an alternate version exists. See Alternate code section below. ### Try: @@ -29,14 +30,17 @@ NOTE: an alternate version exists. See Alternate code section below. ## Alternate code: -To use: +This version sleeps in between writes for a compiled in constant microseconds +via `usleep(3)`, defaulting at 200. + + +### Alternate build: + ```sh make alt ``` -Use `plummer.alt` as you would `plummer`. - If you wish to change the time to sleep (default `200`) you can do so like: ```sh @@ -44,6 +48,12 @@ make clobber CDEFINE="-DZ=50" alt ``` +### Alternate use: + + +Use `plummer.alt` as you would `plummer`. + + ### Alternate try: ```sh @@ -78,6 +88,8 @@ compilers) complain that there is no control path leading to a return from `main()`. At 125 characters, it still fits on a single line (for those of us who don't mind ruining our eyes with 132 column screens). +### Spoiler: + The first statement points the base of `l` (the argument vector) to be the first argument by incrementing it. It then assigns `O` to point to the character before the first character of the second diff --git a/1993/rince/Makefile b/1993/rince/Makefile index f5eb64762..199952b45 100644 --- a/1993/rince/Makefile +++ b/1993/rince/Makefile @@ -115,8 +115,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= ${PROG}.alt.o -ALT_TARGET= ${PROG}.alt +ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o +ALT_TARGET= ${PROG}.alt ${PROG}.alt2 ################# diff --git a/1993/rince/README.md b/1993/rince/README.md index 6d0863d2b..c2d4cbeb6 100644 --- a/1993/rince/README.md +++ b/1993/rince/README.md @@ -4,8 +4,22 @@ 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. +NOTE: there are two alternate versions of this program, both allowing one to +slow down the game and the second one with movements more familiar to vi users. +See the [Alternate code](#alternate-code) section below. + + +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: INABIAF - please **DO NOT** fix +``` + +For more detailed information see [1993 rince in bugs.md](/bugs.md#1993-rince). + + ## To use: @@ -18,7 +32,8 @@ where: `[cabbage]` is a CABBAGE description file (default: `rince.c`) -## Alternate code: slowing down the game + +## Alternate code Some people may want to slow down the game by increasing the value 17 in the lines: @@ -34,7 +49,15 @@ and 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: +to another value like 18 or 19 which you can do with the alternate code. + +In the case of [rince.alt2.c](rince.alt2.c) the movement keys for the default +game are slightly different and will feel more familiar to vi users: `h` for +left, `l` for right (that was not changed) and `k` for fire (that was also not +changed). + + +### Alternate build: ```sh @@ -43,7 +66,10 @@ make CDEFINE="-DZ=18" clobber alt Replace 18 with whatever number you wish. -Use `rince.alt` as you would `rince` above. + +### Alternate use: + +Use `rince.alt` or `rince.alt2` as you would `rince` above. ## Judges' remarks: @@ -65,37 +91,6 @@ considered finished when all the `m`s are then `M`s. For a brief design description, see [design.md](design.md). -The `select(2)` from SunOS says: - -``` -BUGS - -... - -select() should probably return the time remaining from the -original timeout, if any, by modifying the time value in -place. This may be implemented in future versions of the -system. Thus, it is unwise to assume that the timeout -pointer will be unmodified by the select() call. -``` - -Systems such as Linux do return the remaining time in timeout -field (0 if no keys were pressed), but `rince` assumes that -timeout remains unmodified. - -It has been suggested that: - -```c -select(k,&y,0,0,&v) -``` - -should be replaced with: - -```c -select(k,&y,0,0,(v.tv_usec=1< o.. ... \.. --> 'o' .o. --> '.' ... .\. - - ``` However, the system I devised, in order to keep things small and neat(!), @@ -27,15 +24,13 @@ Hence: .o. ... .\. --> .\o ... ... - ``` -This does of course have the odd problem with clashes. What if we want to -roll two down boulders down simultaneously towards the same square. -I perform no buffering, and so this situation is just a 'fight it out' and -let which ever transition has priority win. Such a case may produce the -following change of maps (depending on which 'roll' transition is used -first). +This does of course have the odd problem with clashes. What if we want to roll +two boulders down simultaneously towards the same square. I perform no +buffering, and so this situation is just a 'fight it out' and let which ever +transition has priority win. Such a case may produce the following change of +maps (depending on which 'roll' transition is used first). ``` o.o ..o o.. @@ -44,7 +39,7 @@ first). ``` I claim that it is possible to perform all of the 3x3 to 1x1 transitions in a -3x3 to 3x3 based system. One other feature added in is a work around for the 'no +3x3 to 3x3 based system. One other feature added in is a workaround for the 'no buffering' problem. If we define a space ship (as in the [Space Invaders](https://en.wikipedia.org/wiki/Space_Invaders) example) to fly right, and we are 'walking through' our map from top-left to bottom-right, then it is @@ -88,7 +83,7 @@ is written as: `eabcdfghi512346789K`. If there are no keys needed for this transition, the character `*1` should be used instead. Now the format of the game description file is now -the following: (angle brackets denote an 'entity' to be defined). +the following (angle brackets denote an 'entity' to be defined): ``` diff --git a/1993/rince/rince.alt.c b/1993/rince/rince.alt.c index 5c9ce9039..9c94833be 100644 --- a/1993/rince/rince.alt.c +++ b/1993/rince/rince.alt.c @@ -120,4 +120,5 @@ int main(int open, U**exit) { t=(j*I*a(Q--,--Q))); t->y=J[Y][c]; J[Y][c]=t; fgets(t->x,20,C); } + endwin(); } diff --git a/1993/rince/rince.c b/1993/rince/rince.c index fbf443aa6..4afe3460a 100644 --- a/1993/rince/rince.c +++ b/1993/rince/rince.c @@ -120,4 +120,5 @@ int main(int open, U**exit) { t=(j*I*a(Q--,--Q))); t->y=J[Y][c]; J[Y][c]=t; fgets(t->x,20,C); } + endwin(); } diff --git a/1993/schnitzi/README.md b/1993/schnitzi/README.md index f7b36587c..7aea47ebe 100644 --- a/1993/schnitzi/README.md +++ b/1993/schnitzi/README.md @@ -5,6 +5,18 @@ make all ``` +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: INABIAF - please **DO NOT** fix +``` + +For more detailed information see [1993 schnitzi in bugs.md](/bugs.md#1993-schnitzi). + + + ## To use: ```sh @@ -16,14 +28,7 @@ where `file` is a file containing some text. -This entry will segfault if the file cannot be opened. This is not a bug. - -This is supposed to happen. As is written in the -[The Jargon File](http://catb.org/jargon/html/F/feature.html): - -``` -That's not a bug, that's a feature. -``` +Certain input will cause the program to fail as described in the bugs.md file. ### Try: @@ -33,13 +38,15 @@ That's not a bug, that's a feature. # ask some questions suggested by the author, noted below ``` -We also suggest you ask the program: +We also suggest you ask the program the following questions: ```sh Who is Mark Schnitzus? + +Who was Jack the Ripper ? ``` -Notice how it still manages to answer the question despite there being an +Notice how it still manages to answer the first question despite there being an intentional spelling error there. Try feeding the program source to the program and ask both: @@ -49,6 +56,9 @@ What is cat ? What is cat? ``` +What happens if you ask it other questions with and without a space before the +`?`? + ## Judges' remarks: @@ -64,16 +74,14 @@ The author suggests the following questions when using - What language is it written in? - Has the Loch Ness monster really been captured? - Who was Hitler? -- Were the NASA moon landings faked? +- Were the NASA Moon landings faked? - Is it true that Elvis is alive? - Do colorless green ideas sleep furiously? -We suggest you try using the body (minus the header and signature line)\ +We suggest you try using the body (minus the header and signature line) of a Usenet article. You might want to try something from alt.flame. :-) -NOTE: If you have a ' in the question this entry might fail. - -NOTE: The author may also be contacted at: marks@aldrin.ksc.nasa.gov. +NOTE: If you have certain `'` in the question this entry might fail. ## Author's remarks: @@ -84,27 +92,28 @@ text file. I thought this might be a complicated task, and I was right -- it took me over 800 bytes. Of course, it doesn't always work, but that's AI for you. -This program accepts the name of a text file as the first -parameter. For example, to run it on the supplied data file called -'info' you would type `./schnitzi info`. It echoes the file, then -gives you a prompt where you may type in questions about that text. -The more words you use which are actually present in the text file, -the better results you get. You'll need to hit `ctrl-c` to break out -of the program. Just hitting `return` at the prompt will reprint the -paragraph. +This program accepts the name of a text file as the first parameter. For +example, to run it on the supplied data file called 'schnitzi.info' you would +type `./schnitzi schnitzi.info`. It echoes the file, then gives you a prompt +where you may type in questions about that text. The more words you use which +are actually present in the text file, the better results you get. You'll need +to hit `ctrl-c` to break out of the program. Just hitting `return` at the +prompt will reprint the paragraph. If you're curious as to how it works, I guess you could feed in the source as the input file and ask "How does this work?" at the prompt, but I'm not guaranteeing any results... + ### Compilation notes -- The use of 'strcasecmp' may be non-standard. 'strcmp' can be substituted for +- The use of `strcasecmp(3)` may be non-standard. `strcmp(3)` can be substituted for it, with a slight performance penalty. - This program depends on the first command-line parameter, typically called -argv[0], to hold the name of the executable. It is my understanding that this -property of argv[0] is not guaranteed on some systems. +`argv[0]`, to hold the name of the executable. It is my understanding that this +property of `argv[0]` is not guaranteed on some systems. + ### Obfuscation @@ -113,7 +122,7 @@ property of argv[0] is not guaranteed on some systems. - The layout, variable names, and expression format have been chosen in such a way as to cause visual confusion. -- It uses uses external `system()` calls to echo the text file and break up the +- It uses uses external `system(3)` calls to echo the text file and break up the question into individual words with a recursive call. - It uses a clever hack to simulate artificial intelligence. diff --git a/bugs.md b/bugs.md index de3d2b22c..b266aba92 100644 --- a/bugs.md +++ b/bugs.md @@ -1011,6 +1011,73 @@ cannot be fixed for modern systems as the bug is long gone. An alternate version, however, does exist. See the README.md file for details. +### STATUS: INABIAF - please **DO NOT** fix +### Source code: [1993/rince/rince.c](1993/rince/rince.c) +### Information: [1993/rince/README.md](1993/rince/README.md) + +Although the code checks if the file can be opened or not, badly formatted files +will cause problems. No other checks are performed either. + +There is no end of game checking method so you will have to quit the game +through ctrl-c or such. + + +### STATUS: INABIAF - please **DO NOT** fix +### Source code: [1993/schnitzi/schnitzi.c](1993/schnitzi/schnitzi.c) +### Information: [1993/schnitzi/README.md](1993/schnitzi/README.md) + +If the file cannot be opened it will very likely segfault. This should not be +fixed except for an exercise to yourself, should you wish to try. + +This program uses `system(3)` so if you provide invalid characters in the +question you might cause an error. For instance don't do this: + +```sh +$ ./schnitzi schnitzi.info +This program answers questions about paragraphs +of text posed to it in English. It is written +in C. Mark Schnitzius is the author of this +program. + +The Loch Ness monster has been captured. Elvis +is alive. Hostler was a woman. The NASA moon +landings were clearly faked. + + +? What is foo'? +``` + +because doing so will result in something like: + +``` +sh: -c: line 0: unexpected EOF while looking for matching `'' +sh: -c: line 1: syntax error: unexpected end of file +``` + +with the program terminating. Other characters will also cause this problem. + +Of course if you do something like: + +``` +What is 'foo'? +``` + +it will work fine. + + +### STATUS: INABIAF - please **DO NOT** fix +### Source code: [1993/vanb/vanb.c](1993/vanb/vanb.c) +### Information: [1993/vanb/README.md](1993/vanb/README.md) + +No spaces are allowed in the expression. + +The program does no error checking so erroneous expressions will produce +spurious results. + +The unary `-` is an operator so decimal `-46` should be entered as `-d46` and +not `d-46`. + + # 1994 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 10c91022c..a9a78c74d 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1610,11 +1610,17 @@ also checks for two args. See the README.md files for details. ## [1993/rince](1993/rince/rince.c) ([README.md](1993/rince/README.md])) -Yusuke supplied a patch to get this to work in modern systems. +Yusuke supplied a patch to get this to work in modern systems. This fix also +applies the compatibility issue of `select(2)` described in the README.md file. -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. +Cody added a call to `endwin()` to help with terminal sanity after the program +ends. + +Cody provided two alternate versions to simplify slowing the game down and, for +the second one, to make movement keys (of the default game) more familiar to vi +users. The slowing down was based on our suggestion that it might be desired to +slow down but Cody did it in such 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]))