Merge pull request #1335 from xexyl/plummer1993

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-11-09 11:26:58 -07:00
commit 6651f8a2cf
9 files changed
+182 -99

No files matched your search

+16 -4
View File
@@ -4,6 +4,8 @@
make all make all
``` ```
There is an [alternate version](#alternate-code) that lets you slow down the
output of the program for modern systems.
## To use: ## To use:
@@ -16,7 +18,6 @@ where:
- number is a number (try 21701) - number is a number (try 21701)
- arg is any argument - arg is any argument
NOTE: an alternate version exists. See Alternate code section below.
### Try: ### Try:
@@ -29,14 +30,17 @@ NOTE: an alternate version exists. See Alternate code section below.
## Alternate code: ## 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 ```sh
make alt 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: If you wish to change the time to sleep (default `200`) you can do so like:
```sh ```sh
@@ -44,6 +48,12 @@ make clobber CDEFINE="-DZ=50" alt
``` ```
### Alternate use:
Use `plummer.alt` as you would `plummer`.
### Alternate try: ### Alternate try:
```sh ```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 `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). who don't mind ruining our eyes with 132 column screens).
### Spoiler:
The first statement points the base of `l` (the argument vector) to The first statement points the base of `l` (the argument vector) to
be the first argument by incrementing it. It then assigns `O` to be the first argument by incrementing it. It then assigns `O` to
point to the character before the first character of the second point to the character before the first character of the second
+2 -2
View File
@@ -115,8 +115,8 @@ OBJ= ${PROG}.o
DATA= DATA=
TARGET= ${PROG} TARGET= ${PROG}
# #
ALT_OBJ= ${PROG}.alt.o ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o
ALT_TARGET= ${PROG}.alt ALT_TARGET= ${PROG}.alt ${PROG}.alt2
################# #################
+42 -50
View File
@@ -4,8 +4,22 @@
make all make all
``` ```
NOTE: there is an alternate version of this program that allows one to slow down NOTE: there are two alternate versions of this program, both allowing one to
the game. See the Alternate code section below. 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: ## To use:
@@ -18,7 +32,8 @@ where:
`[cabbage]` is a CABBAGE description file (default: `rince.c`) `[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 Some people may want to slow down the game by increasing the
value 17 in the lines: 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; 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 ```sh
@@ -43,7 +66,10 @@ make CDEFINE="-DZ=18" clobber alt
Replace 18 with whatever number you wish. 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: ## 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). 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<<whatever_you_want,&v))
```
where `whatever_you_want` is some integer such as 17 or 19.
### WARNING for SunOS 4.1.x: ### WARNING for SunOS 4.1.x:
@@ -104,14 +99,12 @@ compiler in the first place), this program may be used to log
out very quickly. Unfortunately, you can't do anything else out very quickly. Unfortunately, you can't do anything else
with it. with it.
### Additional notes
One may also need to do a `stty sane` if you kill the program ### Additional notes
to restore your terminal state. If that does not work try `reset`.
Some people report that `rince` dumps core on their system. Some people report that `rince` dumps core on their system.
On some systems that use gcc, the curses.h used by gcc (typically On some systems that use gcc, the `curses.h` used by gcc (typically
`/usr/local/include/curses.h` if not `/usr/include/curses.h`) is not compatible `/usr/local/include/curses.h` if not `/usr/include/curses.h`) is not compatible
with the curses library (typically `/lib/libcurses.a` for static libraries) with the curses library (typically `/lib/libcurses.a` for static libraries)
used. It has been suggested that the following gcc command may help: used. It has been suggested that the following gcc command may help:
@@ -149,11 +142,11 @@ Levels : Ahh well... it's not *totally* generic.
The proper definition for usage would be: `./rince [data_filename]` The proper definition for usage would be: `./rince [data_filename]`
### Portability ### Portability
I have compiled in on the following systems: I have compiled in on the following systems:
---
``` ```
System OS Compiler (and flags) System OS Compiler (and flags)
DECstation 5000/240 Ultrix 4.2A c89 -std DECstation 5000/240 Ultrix 4.2A c89 -std
@@ -163,21 +156,20 @@ DECAlpha 3000/500 OSF/1 V1.2 c89 -std
SGI Indigo (R4000) IRIX 4.0.5F cc -ansi SGI Indigo (R4000) IRIX 4.0.5F cc -ansi
Alliant FX2800 Conentrix 3.0.0 fxc Alliant FX2800 Conentrix 3.0.0 fxc
``` ```
---
\* I never said it worked! The guidelines state that you dislike programs that \* I never said it worked! The guidelines state that you dislike programs that
won't *compile* under both BSD or SysV `Unix`. This compiles, and indeed runs won't *compile* under both BSD or SysV `Unix`. This compiles, and indeed runs
on all the others (both BSD and SysV) correctly. on all the others (both BSD and SysV) correctly.
Alas, on Solaris it compiles, but mysteriously stops displaying output Alas, on Solaris it compiles, but mysteriously stops displaying output
after a while until you quit with control C, when it all catches up again. after a while until you quit with control-c, when it all catches up again.
I think the problem may lie in either select(), or curses, (or perhaps I think the problem may lie in either `select(2)`, or curses, (or perhaps
conflict of the two). conflict of the two).
The use of `select()` no doubt makes it less portable to STRICT SysV The use of `select(2)` no doubt makes it less portable to STRICT SysV machines.
machines. However I have tested this on several so-called SysV However I have tested this on several so-called SysV machines, and all of them
machines, and all of them support `select()`. In fact, the `select()` they support `select(2)`. In fact, the `select(2)` they support appears to be more
support appears to be more portable between them than their `poll()` call. portable between them than their `poll()` call.
### Obfuscation ### Obfuscation
@@ -201,7 +193,7 @@ Of course, all the usual obfuscation lurks within, such as combining
multiple for loops into single ones; warped and twisted logic; plus a multiple for loops into single ones; warped and twisted logic; plus a
plethora of other minor oddities. It's up to you to discover some of them plethora of other minor oddities. It's up to you to discover some of them
of course... Sometimes I have sacrificed length for obfuscation. It is all of course... Sometimes I have sacrificed length for obfuscation. It is all
too easy to change the arguments in main to one character identifiers, but too easy to change the arguments in `main()` to one character identifiers, but
in my opinion they add to obfuscation in this case by being longer. in my opinion they add to obfuscation in this case by being longer.
`lint` complains about lots of things. Firstly the use of curses immediately `lint` complains about lots of things. Firstly the use of curses immediately
@@ -218,7 +210,7 @@ insufficient memory) is performed.
There is no 'end of game' checking method. Hence games like Sokoban rely There is no 'end of game' checking method. Hence games like Sokoban rely
on the user to decide when they have had enough. Also, there is no quit on the user to decide when they have had enough. Also, there is no quit
mechanism other than control C. mechanism other than control-c.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License:
+7 -12
View File
@@ -10,13 +10,10 @@ For instance, assume you wish to make a boulder `o` roll off a hill `/`
A standard automata would have 2 rules something like this: A standard automata would have 2 rules something like this:
``` ```
<pre>
o.. ... o.. ...
\.. --> 'o' .o. --> '.' \.. --> 'o' .o. --> '.'
... .\. ... .\.
</pre>
``` ```
However, the system I devised, in order to keep things small and neat(!), However, the system I devised, in order to keep things small and neat(!),
@@ -27,15 +24,13 @@ Hence:
.o. ... .o. ...
.\. --> .\o .\. --> .\o
... ... ... ...
``` ```
This does of course have the odd problem with clashes. What if we want to This does of course have the odd problem with clashes. What if we want to roll
roll two down boulders down simultaneously towards the same square. two boulders down simultaneously towards the same square. I perform no
I perform no buffering, and so this situation is just a 'fight it out' and buffering, and so this situation is just a 'fight it out' and let which ever
let which ever transition has priority win. Such a case may produce the transition has priority win. Such a case may produce the following change of
following change of maps (depending on which 'roll' transition is used maps (depending on which 'roll' transition is used first).
first).
``` ```
o.o ..o o.. 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 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 buffering' problem. If we define a space ship (as in the [Space
Invaders](https://en.wikipedia.org/wiki/Space_Invaders) example) to fly right, 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 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 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 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):
``` ```
+1
View File
@@ -120,4 +120,5 @@ int main(int open, U**exit) {
t=(j*I*a(Q--,--Q))); t=(j*I*a(Q--,--Q)));
t->y=J[Y][c]; J[Y][c]=t; t->y=J[Y][c]; J[Y][c]=t;
fgets(t->x,20,C); } fgets(t->x,20,C); }
endwin();
} }
+1
View File
@@ -120,4 +120,5 @@ int main(int open, U**exit) {
t=(j*I*a(Q--,--Q))); t=(j*I*a(Q--,--Q)));
t->y=J[Y][c]; J[Y][c]=t; t->y=J[Y][c]; J[Y][c]=t;
fgets(t->x,20,C); } fgets(t->x,20,C); }
endwin();
} }
+36 -27
View File
@@ -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: ## To use:
```sh ```sh
@@ -16,14 +28,7 @@ where
`file` is a file containing some text. `file` is a file containing some text.
This entry will segfault if the file cannot be opened. This is not a bug. Certain input will cause the program to fail as described in the bugs.md file.
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.
```
### Try: ### Try:
@@ -33,13 +38,15 @@ That's not a bug, that's a feature.
# ask some questions suggested by the author, noted below # 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 ```sh
Who is Mark Schnitzus? 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. intentional spelling error there.
Try feeding the program source to the program and ask both: Try feeding the program source to the program and ask both:
@@ -49,6 +56,9 @@ What is cat ?
What is cat? What is cat?
``` ```
What happens if you ask it other questions with and without a space before the
`?`?
## Judges' remarks: ## Judges' remarks:
@@ -64,16 +74,14 @@ The author suggests the following questions when using
- What language is it written in? - What language is it written in?
- Has the Loch Ness monster really been captured? - Has the Loch Ness monster really been captured?
- Who was Hitler? - Who was Hitler?
- Were the NASA moon landings faked? - Were the NASA Moon landings faked?
- Is it true that Elvis is alive? - Is it true that Elvis is alive?
- Do colorless green ideas sleep furiously? - 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. :-) 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: If you have certain `'` in the question this entry might fail.
NOTE: The author may also be contacted at: marks@aldrin.ksc.nasa.gov.
## Author's remarks: ## 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 right -- it took me over 800 bytes. Of course, it doesn't always
work, but that's AI for you. work, but that's AI for you.
This program accepts the name of a text file as the first This program accepts the name of a text file as the first parameter. For
parameter. For example, to run it on the supplied data file called example, to run it on the supplied data file called 'schnitzi.info' you would
'info' you would type `./schnitzi info`. It echoes the file, then type `./schnitzi schnitzi.info`. It echoes the file, then gives you a prompt
gives you a prompt where you may type in questions about that text. where you may type in questions about that text. The more words you use which
The more words you use which are actually present in the text file, are actually present in the text file, the better results you get. You'll need
the better results you get. You'll need to hit `ctrl-c` to break out to hit `ctrl-c` to break out of the program. Just hitting `return` at the
of the program. Just hitting `return` at the prompt will reprint the prompt will reprint the paragraph.
paragraph.
If you're curious as to how it works, I guess you could feed in the 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, source as the input file and ask "How does this work?" at the prompt,
but I'm not guaranteeing any results... but I'm not guaranteeing any results...
### Compilation notes ### 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. it, with a slight performance penalty.
- This program depends on the first command-line parameter, typically called - 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 `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. property of `argv[0]` is not guaranteed on some systems.
### Obfuscation ### 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 - The layout, variable names, and expression format have been chosen in such a
way as to cause visual confusion. 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. question into individual words with a recursive call.
- It uses a clever hack to simulate artificial intelligence. - It uses a clever hack to simulate artificial intelligence.
+67
View File
@@ -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. 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 # 1994
+10 -4
View File
@@ -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])) ## [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 Cody added a call to `endwin()` to help with terminal sanity after the program
based on our suggestion that it might be desired to slow down but done in a way ends.
that makes it easy to configure at compile time. See the README.md for details.
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])) ## [1993/schnitzi](1993/schnitzi/schnitzi.c) ([README.md](1993/schnitzi/README.md]))