Merge pull request #128 from xexyl/1993-leo

Update 1993/leo/README.md
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-03-23 17:23:40 -07:00
commit 0cbb632ee0
1 file changed
+9 -30
+9 -30
View File
@@ -10,15 +10,22 @@
make all make all
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work with
modern compilers. Thank you Cody!
### To run ### To run
To have the computer guess: To have the computer guess:
./leo [colors] ./leo [colors]
To guess the computer's number: To guess the computer's number:
./mind [colors] ./mind [colors]
where: where:
colors number of possible colors (1 to 15) (default: 6) colors number of possible colors (1 to 15) (default: 6)
## Judges' comments ## Judges' comments
@@ -30,34 +37,6 @@
We look forward to more entries from the newer members of the We look forward to more entries from the newer members of the
International Internet community. International Internet community.
On more modern systems we had to make the following changes to get it to
compile:
--- i/1993/leo/leo.c
+++ w/1993/leo/leo.c
@@ -1,19 +1,20 @@
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
+#include <time.h>
#define A(x) (e^d)&i?e:(e+=i+i/15-d,d<<=4,i<<=4,x)
#define B b+=!((e^d)&i)&&(d|=i),i<<=4,
#define C i=15,B B B B d=d<<4|d>>12,
#define D=(d=g,b=0,C b<<=4, C C C b)
#define E if(**y)goto
#define F=a[rand()%c]
#define G unsigned short
#define H e^=a[z],a[z]^=e,e^=a[z],
-void
+int
to successfully build this entry.
## Author's comments ## Author's comments
This program plays mastermind, if you call it by a name ending by This program plays mastermind, if you call it by a name ending by
@@ -80,12 +59,12 @@
is, however, quite straightforward :-) , as well as the arithmetic is, however, quite straightforward :-) , as well as the arithmetic
of binary coded colors-base numbers is. of binary coded colors-base numbers is.
Limitations: maximum number of digits (colors) is 14 (1..F). ### Limitations: maximum number of digits (colors) is 14 (1..F).
Suggestions: Use terminal (or emulator) with non-destructive Suggestions: Use terminal (or emulator) with non-destructive
backspaces. Do "disable scrolling" on cmdtool or similar emulators. backspaces. Do "disable scrolling" on cmdtool or similar emulators.
Bugs: Please don't type ^D at the prompt!! #### Bugs: Please don't type ^D at the prompt!!
EXAMPLE: Suppose we think of 1234: EXAMPLE: Suppose we think of 1234: