[net.games.hack] Tainted meat Spoiler Possible bug fix

ron@uthub.UUCP (Ron Wessels) (06/27/85)

> From: ryan@ucla-cs.UUCP
> 
> By the way, I have never encountered this problem due to the fact
> that i eat the corpse as soon as possible....(like after the kill)

> From: srt@ucla-cs.UUCP
> 
> I ate these corpses immediately after killing them, and they were tainted.

Sorry, Ryan, but that doesn't guarantee anything.  I once ate a fresh
giant rat corpse and it was tainted.  I was not impressed!

As a result of this discussion, I finally got around to checking the
source.  You're supposed to have a guaranteed 50-move grace period
before tainting can occur.  I checked around, and the only thing I
could spot was a *really* obscure "bug" that never happens.

As background, the age of any item is stored as a timestamp (# of moves
played) when it was created.  The "true" age can then be determined by
subtracting this from the current move count.

The tainted meat test looks like
		if (moves > age + 50 + rnd(100)) {
			/* it is tainted */
			...
Well, if "age+50+rnd(100)" overflows the maximum value for long's
but "moves" hasn't overflowed yet (I *told* you it was obscure -
the maximum "window" for this is 149 moves and occurs after about
2147483600 moves!), the test will always return tainted.  If this
really is the bug, it can be fixed by changing the test to
		if (moves - age > 50 + rnd(100)) {
			...
[ This is at the top of eatcorpse() in hack.eat.c, if you actually
plan to fix this ].

The problem is that this is a ridiculous number of required moves,
unless "moves" somehow gets corrupted.  If so, this is one of the
few places that you'd notice, since only count differences are ever
looked at.  Either way, the change can't hurt, and might help.

-- 
Ron Wessels	Computer Systems Research Institute	University of Toronto
UUCP:	{decvax,floyd,ihnp4,linus,utzoo,uw-beaver}!utcsri!ron
CSNET:	ron@Toronto
ARPA:	ron%Toronto@CSNet-Relay