Usenet.com

www.Usenet.com

Group Index

Rec Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Sacrificing cats



mcv wrote:
Ray Dillinger <[EMAIL PROTECTED]> wrote:
:> : It becomes interesting in that case whether the crucial test is a : zero check or a less-than-or-equal-to-zero check. If it's a zero : check you have to figure out exactly how many cats and of what kinds
: you can kill in order to cause the rollover to happen and bring the : Cat Lord's idea of # of cats killed back to zero. It could be quite
: a daunting quest. If it's a less-than-or-equal-to-zero check though, : you'd just need to kill at least X but no more than Y to put the : counter somewhere in the negative range.


So let this be a lesson for all programmers: when counting killed monsters,
use unsigned ints (or longs, shorts, chars or whatever, although longer is
probably better).

I'm sure that more important counters will overflow before the kill list counters go past 2147483647. In any case, even if you find a cat every ten seconds, you would need more than 600 years (real-life time, of course) to kill that many. Quite a challenge indeed!


Back in the old days when 16-bit ints were the norm, some Russian Tetris gods managed to get past 32767 points (8000 was an excellent score in the original implementation) and were quite annoyed about ending up in the negatives. A similar thing happened to me with the old Atari XL-game "Pooyan" (anyone remember that?) when my score went from 999,800 to 1.

Malte




<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.