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
```
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
+2 -2
View File
@@ -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
#################
+42 -50
View File
@@ -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<<whatever_you_want,&v))
```
where `whatever_you_want` is some integer such as 17 or 19.
### 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
with it.
### Additional notes
One may also need to do a `stty sane` if you kill the program
to restore your terminal state. If that does not work try `reset`.
### Additional notes
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
with the curses library (typically `/lib/libcurses.a` for static libraries)
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]`
### Portability
I have compiled in on the following systems:
---
```
System OS Compiler (and flags)
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
Alliant FX2800 Conentrix 3.0.0 fxc
```
---
\* 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
on all the others (both BSD and SysV) correctly.
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.
I think the problem may lie in either select(), or curses, (or perhaps
after a while until you quit with control-c, when it all catches up again.
I think the problem may lie in either `select(2)`, or curses, (or perhaps
conflict of the two).
The use of `select()` no doubt makes it less portable to STRICT SysV
machines. However I have tested this on several so-called SysV
machines, and all of them support `select()`. In fact, the `select()` they
support appears to be more portable between them than their `poll()` call.
The use of `select(2)` no doubt makes it less portable to STRICT SysV machines.
However I have tested this on several so-called SysV machines, and all of them
support `select(2)`. In fact, the `select(2)` they support appears to be more
portable between them than their `poll()` call.
### 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
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
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.
`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
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:
+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:
```
<pre>
o.. ...
\.. --> 'o' .o. --> '.'
... .\.
</pre>
```
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):
```
+1
View File
@@ -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();
}
+1
View File
@@ -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();
}
+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:
```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.
+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.
### 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
+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]))
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]))