Fix infinite loop in 2000/robison w/invalid input

If someone entered invalid input (say because they don't know the format
yet or because they make a typo or some other reason) their terminal
would be flooded with an error message, forcing them to kill the game.
This was done in much the same way as the fix for 1987/lievaart. Without
this fix the words:

    Black position and direction: illegal

would flood the screen.

The Makefile CINCLUDE now has -include stdio.h (not strictly necessary
however).

Format and typo check README.md.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-14 11:49:59 -08:00
1 parent 396f92f9b0
commit 5a99d745c5
4 files changed
+65 -28

No files matched your search

+1 -1
View File
@@ -63,7 +63,7 @@ CDEFINE=
# Include files that are needed to compile
#
CINCLUDE=
CINCLUDE= -include stdio.h
# Optimization
#
+13 -12
View File
@@ -12,13 +12,6 @@ make
```
### Try:
```sh
echo "Do or do not. There is no try."
```
## Judges' remarks:
The program plays almost always reasonably, but does not always detect
@@ -33,27 +26,32 @@ author a patent he applied for. :-)
## Author's remarks:
### TITLE OF INVENTION
Highly Compressed Program for Playing Hygienic Checkers
### FIELD OF INVENTION
The present invention generally relates to
[checkers](https://en.wikipedia.org/wiki/Checkers).
### BACKGROUND OF THE INVENTION
Within the field of [checkers](https://en.wikipedia.org/wiki/Checkers), the
Within the field of [Checkers](https://en.wikipedia.org/wiki/Checkers), the
problem of finding a hygienic opponent is difficult, as good opponents are
peculiar to the tavern habitat of cracker-barrels, pot-belly stoves, tobacco,
and spittoons.
### BRIEF SUMMARY OF THE INVENTION
The present invention plays [checkers](https://en.wikipedia.org/wiki/Checkers)
The present invention plays [Checkers](https://en.wikipedia.org/wiki/Checkers)
without spitting.
### BRIEF DESCRIPTION OF SEVERAL VIEWS OF THE INVENTION
FIG. 1 shows a numbering of positions.
@@ -64,6 +62,7 @@ FIG. 3 shows a sample board.
FIG. 4 shows a method in accordance with the present invention.
### DETAILED DESCRIPTION OF THE INVENTION
Operator plays Black (`x`); the program plays White (`o`). Said Black goes first.
@@ -85,7 +84,7 @@ said loser.
FIG. 4 shows a C program in accordance with the present invention. Control flow
is straightforward: control enters routine `main()`, executes a plurality of
statements, and exits via `return` statement. FIG. 4 presumes that type `int`
statements, and exits via a `return` statement. FIG. 4 presumes that type `int`
is `32 bits` and `short` is `16 bits`, which are essential to the preferred
embodiment of the invention. FIG. 4 also presumes that the host computer uses
ASCII encoding for characters. It should be obvious that practitioners skilled
@@ -95,6 +94,7 @@ The disclosure here describes a particular embodiment of the present invention,
and other embodiments within the spirit of this disclosure are possible, as well
as consumption of spirits while playing.
### CLAIMS
I claim, by letters patently absurd:
@@ -110,10 +110,10 @@ I claim, by letters patently absurd:
and beta cuts.
3. The method of claim 1, further comprising the step of formatting the
source code with short lines, in order to impress manager with
source code with short lines, in order to impress the manager with
high productivity, when measured in lines of code.
4. The method of claim 3, further comprising the step for telling
4. The method of claim 3, further comprising the step for telling the
skeptical manager that this is the well-known technique of
"linear programming".
@@ -129,6 +129,7 @@ I claim, by letters patently absurd:
sequence to either sum a plurality of bits in an N-bit word or reverses
them, in lg(N) time, depending upon a parameter.
### DRAWINGS
#### FIG 1.
+37 -15
View File
@@ -689,22 +689,44 @@ C
o&
4)
{
o&
1?
char
X1[
5]=
{'\
\0'}
,X2
[5]
={\
'\0\
'};
C o
&1
){
scanf
("%d"
,&
n)
:(
("%4s"
,X1);
n=at\
oi(X1);
}else
{X1[
0]=
'\
\0'
;X2
[0]
='\0';
scanf
("%d%d"
,&
m,
&n
),
--
m)
;
("%4s\
%4s",
X1,
X2);
m=
atoi
(X1);
n=
atoi
(X2)
;--m;
Z=
A
N>>
@@ -729,7 +751,7 @@ B,
H"{ ; { { } { } { ; } ; { "
))
;
}
}}
}
else
{