From: Eric S. Raymond Date: Wed, 1 Mar 2017 01:21:05 +0000 (-0500) Subject: Prevent off-by-one error do to real variables. X-Git-Tag: 2.2~9 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=6c6420478d3ea0eb4359ea94e73821a30b970399;p=super-star-trek.git Prevent off-by-one error do to real variables. --- diff --git a/sst.py b/sst.py index 409ba7a..77740da 100755 --- a/sst.py +++ b/sst.py @@ -1180,7 +1180,7 @@ def collision(rammed, enemy): game.damage[dev] += game.optime + extradm game.shldup = False prout(_("***Shields are down.")) - if game.state.remkl + len(game.state.kcmdr) + game.state.nscrem: + if game.unwon(): announce() damagereport() else: @@ -5733,7 +5733,7 @@ def setup(): klumper = MAXKLQUAD while True: r = randreal() - klump = (1.0 - r*r)*klumper + klump = int((1.0 - r*r)*klumper) if klump > krem: klump = krem krem -= klump @@ -5742,7 +5742,7 @@ def setup(): if not game.state.galaxy[w.i][w.j].supernova and \ game.state.galaxy[w.i][w.j].klingons + klump <= MAXKLQUAD: break - game.state.galaxy[w.i][w.j].klingons += int(klump) + game.state.galaxy[w.i][w.j].klingons += klump if krem <= 0: break # Position Klingon Commander Ships