return math.sqrt((self.i - other.i)**2 + (self.j - other.j)**2)
def bearing(self, other=None):
if not other: other = coord(0, 0)
- return 1.90985*math.atan2(self.i-other.i, self.j-other.j)
+ return 1.90985*math.atan2(self.j-other.j, self.i-other.i)
def sgn(self):
s = coord()
if self.i == 0:
shoved = True
elif iquad in (IHC, IHS, IHR, IHK): # Hit a regular enemy
# find the enemy
- if withprob(0.05):
+ if iquad in (IHC, IHS) and withprob(0.05):
prout(crmena(True, iquad, "sector", w) + _(" uses anti-photon device;"))
prout(_(" torpedo neutralized."))
return None
prout(_(" the Captain's psychological profile.\""))
scanner.chew()
return None
- return 1.90985932*math.atan2(delta.j, delta.i)
+ return delta.bearing()
def photon():
"Launch photon torpedo."
prout(_("Ensign Chekov- \"Course laid in, Captain.\""))
# the actual deltas get computed here
delta = coord()
- delta.i = dquad.j-game.quadrant.j + 0.1*(dsect.j-game.sector.j)
- delta.j = game.quadrant.i-dquad.i + 0.1*(game.sector.i-dsect.i)
+ delta.j = dquad.j-game.quadrant.j + 0.1*(dsect.j-game.sector.j)
+ delta.i = game.quadrant.i-dquad.i + 0.1*(game.sector.i-dsect.i)
else: # manual
while key == "IHEOL":
proutn(_("X and Y displacements- "))