Merge pull request #1425 from xexyl/robison2k-fix

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-11-15 00:06:20 -07:00
commit 601aa2363f
7 files changed
+80 -34

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
{
+3 -3
View File
@@ -114,7 +114,7 @@ PROG= prog
#
OBJ= ${PROG}.o
CSRC= ${PROG}.o
DATA= maze demo.sh
DATA= maze try.sh
TARGET= ${PROG}
#
ALT_OBJ=
@@ -141,8 +141,8 @@ ${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
${LN} -sf ${PROG} tbfs
test: prog
${CAT} prog.c | ./prog
test: ${PROG}
./${PROG} < ${PROG}.c
# alternative executable
+1 -1
View File
@@ -26,7 +26,7 @@ The last two can be done in a sequence, first showing the respective files at
the terminal, like:
```sh
./demo.sh
./try.sh
```
+11 -2
View File
@@ -5,8 +5,17 @@
# Doesn't run the program on README.md as it's longer and slower.
#
# make prog first and exit if failure
make || exit
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# display prog.c to the user
echo "$ cat prog.c"
+14
View File
@@ -2304,6 +2304,20 @@ Cody also added the [try.sh](2000/primenum/try.sh) script.
Cody added the [try.sh](2000/rince/try.sh) script.
## [2000/robison](2000/robison/robison.c) ([README.md](2000/robison/README.md]))
Cody fixed an infinite loop that occurred if invalid input was entered, flooding
the screen with:
```
Black position and direction: illegal
```
This was fixed by having the `scanf(3)` read in a string and then use `atoi(3)`
on it to assign to the `int`s, much like with `1987/lievaart`. The strings are
`char[5]` and the `%` specifier is `%4s` which is enough for the game.
## [2000/thadgavin](2000/thadgavin/thadgavin.c) ([README.md](2000/thadgavin/README.md]))
Cody fixed the code and added an appropriate make rule so that the SDL version