From 7f90bed5207463b34bd3b46981a89d0d0da23707 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:59:41 -0800 Subject: [PATCH 1/4] Format/typo check 1993/schnitzi + update bugs.md --- 1993/schnitzi/README.md | 63 +++++++++++++++++++++++------------------ bugs.md | 56 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 27 deletions(-) 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..c32f4b983 100644 --- a/bugs.md +++ b/bugs.md @@ -1011,6 +1011,62 @@ 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/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 From a28bd67968b4e933f8775ddfe5d627da4eab9c35 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 9 Nov 2023 09:17:29 -0800 Subject: [PATCH 2/4] Some fixes in 1993/rince It was stated, perhaps even by me but no longer sure of this (it looks like my style) that after the program is terminated the terminal might not be sane and one could do 'stty sane', 'reset' and other things. Instead I have changed the code to just call endwin() and removed that information instead. This way the user should not be burdened by it. The alt code that I had added earlier on also has this fix. The markdown files have not been completely checked but both README.md and design.md have had some fixes applied. The thanks file also points out that Yusuke's fix applies the suggested fix for select(2) found in the README.md. --- 1993/rince/README.md | 19 ++++++++++++------- 1993/rince/design.md | 4 ---- 1993/rince/rince.alt.c | 1 + 1993/rince/rince.c | 1 + thanks-for-fixes.md | 6 +++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/1993/rince/README.md b/1993/rince/README.md index 6d0863d2b..7c6a867b9 100644 --- a/1993/rince/README.md +++ b/1993/rince/README.md @@ -5,7 +5,7 @@ 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. +the game. See the [Alternate code](#alternate-code) section below. ## To use: @@ -18,7 +18,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 +35,10 @@ 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. + + +### Alternate build: ```sh @@ -43,6 +47,9 @@ make CDEFINE="-DZ=18" clobber alt Replace 18 with whatever number you wish. + +### Alternate use: + Use `rince.alt` as you would `rince` above. @@ -97,6 +104,7 @@ 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,7 +24,6 @@ Hence: .o. ... .\. --> .\o ... ... - ``` This does of course have the odd problem with clashes. What if we want to 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/thanks-for-fixes.md b/thanks-for-fixes.md index 10c91022c..92bb8c6d9 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1610,7 +1610,11 @@ 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 added a call to `endwin()` to help with terminal sanity after the program +ends. 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 From 0cc4ba731305e22e2ee81030ff1adc585f1ec574 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 9 Nov 2023 09:40:45 -0800 Subject: [PATCH 3/4] Add another alt version to 1993/rince + formatting The formatting of the README.md file has been completed. Typos were also fixed. The formatting of the design.md has been completed. Typos were also fixed. The second alt version makes movement for the default game (which is in the source code itself) more familiar to vi users. It is an exercise for others to change the somewhat awkward keys for other games. Looking at design.md might be of help there. The bugs.md has been updated with a set of features, not bugs, that should no be fixed. --- 1993/rince/Makefile | 4 +-- 1993/rince/README.md | 77 ++++++++++++++++++-------------------------- 1993/rince/design.md | 15 ++++----- bugs.md | 11 +++++++ thanks-for-fixes.md | 8 +++-- 5 files changed, 57 insertions(+), 58 deletions(-) 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 7c6a867b9..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](#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: @@ -37,6 +51,11 @@ refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0; 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: @@ -50,7 +69,7 @@ Replace 18 with whatever number you wish. ### Alternate use: -Use `rince.alt` as you would `rince` above. +Use `rince.alt` or `rince.alt2` as you would `rince` above. ## Judges' remarks: @@ -72,38 +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< Date: Thu, 9 Nov 2023 10:15:55 -0800 Subject: [PATCH 4/4] Format/typo check 1993/plummer --- 1993/plummer/README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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