Dave Lawrence (12/13/88)
[The following summary, with the patch files, has been sent to the
moderator of comp.sources.games for approval by Mr Lo. This is
posted here to make others aware of the bug and offer the fixes
in case they are not approved (probably noted by their absence
in comp.sources.games -- if they don't appear withing a week,
I'll presume rejection for some reason. ]
BUGS
o ^D (EOF) on stdin causes input routines to endlessly loop.
o When the programme asks "What is the probability of getting
the improbability?" the answer is assumed to contain a
decimal point. If none is entered, a signal SEGV occurs.
FIXES
o A routine was added to parser.c named trapEOF and the eofgets()
macro facilitates this call. ^D now terminates the programme
with exit code 1.
o The input to the question now accepts forms of 50, 50.7, 0.50
and 1/2, all returning a value equivalent to 50%. Other input
(1/,fifty percent) will simply be interpreted as 0.
AESTHETIC CHANGES
o A -f option was allowed. This causes the programme to start
in the researcher's office. The title and instructions are skipped.
o The prompt at the end of the title screen lets you skip the
instructions.
o srand() is now randomized by the system clock. It had been
randomized by the values returned from get_enter() at the
first two screens, but this usually resulted in sum being
always set to a value of 86 as most people don't type anything
at a prompt that says to just press <enter>.
o The code now passes the lint test. It barfed in a big way
with the original code as numerous return codes were not
checked and some return values were inconsistent. The
latter was caused by the absence of string.h; to keep
portability, I included extern definitions to the
common string functions used in the programme. I don't
know whether it will compile with Datalight (?) C
as I don't have access to that compiler. All casting
to (void) will also have to be removed on compilers
without void.
o fgets replaced all gets calls because gets is inherently
evil.
o The printing of the title screen when exiting the programme
has been removed. It just isn't in the spirit of UNIX. |:-)
Dave
--
tale@rpitsmts.bitnet, tale%mts@rpitsgw.rpi.edu, tale@pawl.rpi.edu