rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def getcd(isprobe, akey): irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 | def getcourse(isprobe, akey): key = 0 dquad = copy.copy(game.quadrant) | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
incr = coord() | dsect = coord() | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
game.direc = -1.0 | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... | |
return | return False | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
return xi = int(aaitem-0.05) | return False xi = int(round(aaitem))-1 | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
return xj = int(aaitem-0.5) | return False xj = int(round(aaitem))-1 | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
xk = aaitem | xk = int(round(aaitem))-1 | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
return xl = aaitem irowq = xi + 0.5 icolq = xj + 0.5 incr.y = xk + 0.5 incr.x = xl + 0.5 | return False xl = int(round(aaitem))-1 dquad.x = xi dquad.y = xj dsect.y = xk dsect.x = xl | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
irowq = xi + 0.5 icolq = xj + 0.5 incr.y = incr.x = 5 | dquad.x = xi dquad.y = xj dsect.y = dsect.x = 4 | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
incr.y = xi + 0.5 incr.x = xj + 0.5 | dsect.y = xi dsect.x = xj | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
if not VALID_QUADRANT(icolq,irowq) or not VALID_SECTOR(incr.x,incr.y): | if not VALID_QUADRANT(dquad.y,dquad.x) or not VALID_SECTOR(dsect.x,dsect.y): | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
prout(_("Helmsman Sulu- \"Course locked in for Sector %s.\"") % incr) | prout(_("Helmsman Sulu- \"Course locked in for Sector %s.\"") % dsect) | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
deltax = icolq - game.quadrant.y + 0.1*(incr.x-game.sector.y) deltay = game.quadrant.x - irowq + 0.1*(game.sector.x-incr.y) | deltax = dquad.y-game.quadrant.y + 0.1*(dsect.x-game.sector.y) deltay = game.quadrant.x-dquad.x + 0.1*(game.sector.x-dsect.y) | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
return | return True | def getcd(isprobe, akey): # get course and distance irowq=game.quadrant.x; icolq=game.quadrant.y; key=0 navmode = "unspecified" itemp = "curt" incr = coord() iprompt = False # Get course direction and distance. If user types bad values, return # with DIREC = -1.0. game.direc = -1.0 if game.landed and not isprobe: pro... |
getcd(False, 0) if game.direc == -1.0: | if not getcourse(isprobe=False, akey=0): | def impulse(): # move under impulse power game.ididit = False if damaged(DIMPULS): chew() skip(1) prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")) return if game.energy > 30.0: getcd(False, 0) if game.direc == -1.0: return power = 20.0 + 100.0*game.dist else: power = 30.0 if power >= game.energy: #... |
imove(False) | imove(novapush=False) | def impulse(): # move under impulse power game.ididit = False if damaged(DIMPULS): chew() skip(1) prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")) return if game.energy > 30.0: getcd(False, 0) if game.direc == -1.0: return power = 20.0 + 100.0*game.dist else: power = 30.0 if power >= game.energy: #... |
getcd(False, 0) if game.direc == -1.0: | if not getcourse(isprobe=False, akey=0): | def warp(timewarp): # move under warp drive blooey = False; twarp = False if not timewarp: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: chew() skip(1) prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: chew() skip(1) prout(_(... |
imove(False) | imove(novapush=False) | def warp(timewarp): # move under warp drive blooey = False; twarp = False if not timewarp: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: chew() skip(1) prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: chew() skip(1) prout(_(... |
getcd(True, key) if game.direc == -1.0: | if not getcourse(isprobe=True, akey=key): | def probe(): # launch deep-space probe # New code to launch a deep space probe if game.nprobes == 0: chew() skip(1) if game.ship == IHE: prout(_("Engineer Scott- \"We have no more deep space probes, Sir.\"")) else: prout(_("Ye Faerie Queene has no deep space probes.")) return if damaged(DDSP): chew() skip(1) prout(_("E... |
if game.iplnet.crystals != present: | if game.iplnet.crystals != "present": | def sensor(): # examine planets in this quadrant if damaged(DSRSENS): if game.options & OPTION_TTY: prout(_("Short range sensors damaged.")) return if game.iplnet == None: if game.options & OPTION_TTY: prout(_("Spock- \"No planet in this quadrant, Captain.\"")) return if game.iplnet.known == "unknown": prout(_("Spock- ... |
prout(_("Spock- \"The inhabited planet %s is located at Sector %s, Captain.\"") % (game.iplnet.name, game.plnet)) | prout(_("Spock- \"The inhabited planet %s ") % game.iplnet.name) prout(_(" is located at Sector %s, Captain.\"") % game.plnet) | def sensor(): # examine planets in this quadrant if damaged(DSRSENS): if game.options & OPTION_TTY: prout(_("Short range sensors damaged.")) return if game.iplnet == None: if game.options & OPTION_TTY: prout(_("Spock- \"No planet in this quadrant, Captain.\"")) return if game.iplnet.known == "unknown": prout(_("Spock- ... |
proutn("%d |" % (i)) | proutn("%d |" % (i+1)) | def chart(): # display the star chart chew() if not damaged(DRADIO): rechart() if game.lastchart < game.state.date and game.condition == "docked": prout(_("Spock- \"I revised the Star Chart from the starbase's records.\"")) rechart() prout(_(" STAR CHART FOR THE KNOWN GALAXY")) if game.state.date > game.lastcha... |
proutn("%2d " % (i)) | proutn("%2d " % (i+1)) | def srscan(): # short-range scan goodScan=True if damaged(DSRSENS): # Allow base's sensors if docked if game.condition != "docked": prout(_(" S.R. SENSORS DAMAGED!")) goodScan=False else: prout(_(" [Using Base's sensors]")) else: prout(_(" Short-range scan")) if goodScan and not damaged(DRADIO): game.state.chart... |
game.tourn = int(aaitem) | game.tourn = int(round(aaitem)) | def choose(needprompt): # choose your game type global thing while True: game.tourn = 0 game.thawed = False game.skill = SKILL_NONE game.length = 0 if needprompt: # Can start with command line options proutn(_("Would you like a regular, tournament, or saved game? ")) scan() if len(citem)==0: # Try again continue if isi... |
seed = int(aaitem) | seed = int(round(aaitem)) | def makemoves(): # command-interpretation loop v = 0 clrscr() setwnd(message_window) while True: # command loop drawmaps(1) while True: # get a command hitme = False game.justin = False game.optime = 0.0 chew() setwnd(prompt_window) clrscr() proutn("COMMAND> ") if scan() == IHEOL: if game.options & OPTION_CURSES: make... |
global inqueue, line, citem | global inqueue, line, citem, aaitem | def scan(): # Get a token from the user global inqueue, line, citem aaitem = 0.0 citem = '' # Read a line if nothing here if inqueue == None: line = cgetline() if curwnd==prompt_window: clrscr() setwnd(message_window) clrscr() # Skip leading white space line = line.lstrip() if line: inqueue = line.split() else: inqueu... |
w.x = int(aaitem) | w.x = int(round(aaitem)) | def debugme(): # access to the internals for debugging proutn("Reset levels? ") if ja() == True: if game.energy < game.inenrg: game.energy = game.inenrg game.shield = game.inshld game.torps = game.intorps game.lsupres = game.inlsr proutn("Reset damage? ") if ja() == True: for i in range(NDEVICES): if game.damage[i] > 0... |
w.y = int(aaitem) | w.y = int(round(aaitem)) | def debugme(): # access to the internals for debugging proutn("Reset levels? ") if ja() == True: if game.energy < game.inenrg: game.energy = game.inenrg game.shield = game.inshld game.torps = game.intorps game.lsupres = game.inlsr proutn("Reset damage? ") if ja() == True: for i in range(NDEVICES): if game.damage[i] > 0... |
if game.quad[QUADSIZE][i]!=IHWEB and game.quad[QUADSIZE][i]!=IHT: | if game.quad[QUADSIZE-1][i]!=IHWEB and game.quad[QUADSIZE-1][i]!=IHT: | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.i == 0 and game.tholian.kloc.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.kloc.i == 0 and game.tholian.kloc.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian.kloc.i == QUADS... |
if game.quad[i][QUADSIZE]!=IHWEB and game.quad[i][QUADSIZE]!=IHT: | if game.quad[i][QUADSIZE-1]!=IHWEB and game.quad[i][QUADSIZE-1]!=IHT: | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.i == 0 and game.tholian.kloc.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.kloc.i == 0 and game.tholian.kloc.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian.kloc.i == QUADS... |
wrefresh(curwnd) | curwnd.refresh() | def prouts(line): "Emit slowly!" for c in line: if not replayfp or replayfp.closed: # Don't slow down replays time.sleep(0.03) proutn(c) if game.options & OPTION_CURSES: wrefresh(curwnd) else: sys.stdout.flush() if not replayfp or replayfp.closed: time.sleep(0.03) |
self.x = x self.y = y | self.i = x self.j = y | def __init__(self, x=None, y=None): self.x = x self.y = y |
self.x = self.y = None | self.i = self.j = None | def invalidate(self): self.x = self.y = None |
return self.x != None and self.y != None | return self.i != None and self.j != None | def is_valid(self): return self.x != None and self.y != None |
return other != None and self.x == other.x and self.y == other.y | return other != None and self.i == other.i and self.j == other.j | def __eq__(self, other): return other != None and self.x == other.x and self.y == other.y |
return coord(self.x+other.x, self.y+other.y) | return coord(self.i+other.i, self.j+other.j) | def __add__(self, other): return coord(self.x+other.x, self.y+other.y) |
return coord(self.x-other.x, self.y-other.y) | return coord(self.i-other.i, self.j-other.j) | def __sub__(self, other): return coord(self.x-other.x, self.y-other.y) |
return coord(self.x*other, self.y*other) | return coord(self.i*other, self.j*other) | def __mul__(self, other): return coord(self.x*other, self.y*other) |
return coord(self.x*other, self.y*other) | return coord(self.i*other, self.j*other) | def __rmul__(self, other): return coord(self.x*other, self.y*other) |
return coord(self.x/other, self.y/other) | return coord(self.i/other, self.j/other) | def __div__(self, other): return coord(self.x/other, self.y/other) |
return coord(self.x/other, self.y/other) | return coord(self.i/other, self.j/other) | def __rdiv__(self, other): return coord(self.x/other, self.y/other) |
return coord(int(round(self.x)), int(round(self.y))) | return coord(int(round(self.i)), int(round(self.j))) | def snaptogrid(self): return coord(int(round(self.x)), int(round(self.y))) |
return math.sqrt((self.x - other.x)**2 + (self.y - other.y)**2) | return math.sqrt((self.i - other.i)**2 + (self.j - other.j)**2) | def distance(self, other=None): if not other: other = coord(0, 0) return math.sqrt((self.x - other.x)**2 + (self.y - other.y)**2) |
return 1.90985*math.atan2(self.x-other.x, self.y-other.y) | return 1.90985*math.atan2(self.i-other.i, self.j-other.j) | def bearing(self, other=None): if not other: other = coord(0, 0) return 1.90985*math.atan2(self.x-other.x, self.y-other.y) |
if self.x == 0: s.x = 0 | if self.i == 0: s.i = 0 | def sgn(self): s = coord() if self.x == 0: s.x = 0 else: s.x = self.x / abs(self.x) if self.y == 0: s.y = 0 else: s.y = self.y / abs(self.y) return s |
s.x = self.x / abs(self.x) if self.y == 0: s.y = 0 | s.i = self.i / abs(self.i) if self.j == 0: s.j = 0 | def sgn(self): s = coord() if self.x == 0: s.x = 0 else: s.x = self.x / abs(self.x) if self.y == 0: s.y = 0 else: s.y = self.y / abs(self.y) return s |
s.y = self.y / abs(self.y) | s.j = self.j / abs(self.j) | def sgn(self): s = coord() if self.x == 0: s.x = 0 else: s.x = self.x / abs(self.x) if self.y == 0: s.y = 0 else: s.y = self.y / abs(self.y) return s |
s.x = self.x + randrange(-1, 2) s.y = self.y + randrange(-1, 2) | s.i = self.i + randrange(-1, 2) s.j = self.j + randrange(-1, 2) | def scatter(self): s = coord() s.x = self.x + randrange(-1, 2) s.y = self.y + randrange(-1, 2) return s |
if self.x == None or self.y == None: | if self.i == None or self.j == None: | def __str__(self): if self.x == None or self.y == None: return "Nowhere" return "%s - %s" % (self.x+1, self.y+1) |
return "%s - %s" % (self.x+1, self.y+1) | return "%s - %s" % (self.i+1, self.j+1) | def __str__(self): if self.x == None or self.y == None: return "Nowhere" return "%s - %s" % (self.x+1, self.y+1) |
if self.kloc.x is not None and self.kloc.y is not None: | if self.kloc.i is not None and self.kloc.j is not None: | def move(self, loc): motion = (loc != self.kloc) if self.kloc.x is not None and self.kloc.y is not None: if motion: if self.type == IHT: game.quad[self.kloc.x][self.kloc.y] = IHWEB else: game.quad[self.kloc.x][self.kloc.y] = IHDOT if loc: self.kloc = copy.copy(loc) game.quad[self.kloc.x][self.kloc.y] = self.type self.k... |
game.quad[self.kloc.x][self.kloc.y] = IHWEB | game.quad[self.kloc.i][self.kloc.j] = IHWEB | def move(self, loc): motion = (loc != self.kloc) if self.kloc.x is not None and self.kloc.y is not None: if motion: if self.type == IHT: game.quad[self.kloc.x][self.kloc.y] = IHWEB else: game.quad[self.kloc.x][self.kloc.y] = IHDOT if loc: self.kloc = copy.copy(loc) game.quad[self.kloc.x][self.kloc.y] = self.type self.k... |
game.quad[self.kloc.x][self.kloc.y] = IHDOT | game.quad[self.kloc.i][self.kloc.j] = IHDOT | def move(self, loc): motion = (loc != self.kloc) if self.kloc.x is not None and self.kloc.y is not None: if motion: if self.type == IHT: game.quad[self.kloc.x][self.kloc.y] = IHWEB else: game.quad[self.kloc.x][self.kloc.y] = IHDOT if loc: self.kloc = copy.copy(loc) game.quad[self.kloc.x][self.kloc.y] = self.type self.k... |
game.quad[self.kloc.x][self.kloc.y] = self.type | game.quad[self.kloc.i][self.kloc.j] = self.type | def move(self, loc): motion = (loc != self.kloc) if self.kloc.x is not None and self.kloc.y is not None: if motion: if self.type == IHT: game.quad[self.kloc.x][self.kloc.y] = IHWEB else: game.quad[self.kloc.x][self.kloc.y] = IHDOT if loc: self.kloc = copy.copy(loc) game.quad[self.kloc.x][self.kloc.y] = self.type self.k... |
return VALID_QUADRANT(iq.x,iq.y) and \ not game.state.galaxy[iq.x][iq.y].supernova and \ game.state.galaxy[iq.x][iq.y].klingons < MAXKLQUAD | return VALID_QUADRANT(iq.i,iq.j) and \ not game.state.galaxy[iq.i][iq.j].supernova and \ game.state.galaxy[iq.i][iq.j].klingons < MAXKLQUAD | def welcoming(iq): "Would this quadrant welcome another Klingon?" return VALID_QUADRANT(iq.x,iq.y) and \ not game.state.galaxy[iq.x][iq.y].supernova and \ game.state.galaxy[iq.x][iq.y].klingons < MAXKLQUAD |
iq.x = game.quadrant.x+(look.x+(QUADSIZE-1))/QUADSIZE - 1 iq.y = game.quadrant.y+(look.y+(QUADSIZE-1))/QUADSIZE - 1 | iq.i = game.quadrant.i+(look.i+(QUADSIZE-1))/QUADSIZE - 1 iq.j = game.quadrant.j+(look.j+(QUADSIZE-1))/QUADSIZE - 1 | def tryexit(enemy, look, irun): "A bad guy attempts to bug out." iq = coord() iq.x = game.quadrant.x+(look.x+(QUADSIZE-1))/QUADSIZE - 1 iq.y = game.quadrant.y+(look.y+(QUADSIZE-1))/QUADSIZE - 1 if not welcoming(iq): return False; if enemy.type == IHR: return False; # Romulans cannot escape! if not irun: # avoid intrudi... |
game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons -= 1 game.state.galaxy[iq.x][iq.y].klingons += 1 | game.state.galaxy[game.quadrant.i][game.quadrant.j].klingons -= 1 game.state.galaxy[iq.i][iq.j].klingons += 1 | def tryexit(enemy, look, irun): "A bad guy attempts to bug out." iq = coord() iq.x = game.quadrant.x+(look.x+(QUADSIZE-1))/QUADSIZE - 1 iq.y = game.quadrant.y+(look.y+(QUADSIZE-1))/QUADSIZE - 1 if not welcoming(iq): return False; if enemy.type == IHR: return False; # Romulans cannot escape! if not irun: # avoid intrudi... |
if 2.0 * abs(m.x) < abs(m.y): m.x = 0 if 2.0 * abs(m.y) < abs(game.sector.x-enemy.kloc.x): m.y = 0 if m.x != 0: if m.x*motion < 0: m.x = -1 | if 2.0 * abs(m.i) < abs(m.j): m.i = 0 if 2.0 * abs(m.j) < abs(game.sector.i-enemy.kloc.i): m.j = 0 if m.i != 0: if m.i*motion < 0: m.i = -1 | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
m.x = 1 if m.y != 0: if m.y*motion < 0: m.y = -1 | m.i = 1 if m.j != 0: if m.j*motion < 0: m.j = -1 | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
m.y = 1 | m.j = 1 | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if m.x < 0: | if m.i < 0: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if m.y < 0: | if m.j < 0: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if look.x < 0 or look.x >= QUADSIZE: | if look.i < 0 or look.i >= QUADSIZE: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if krawlx == m.x or m.y == 0: | if krawlx == m.i or m.j == 0: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
look.x = next.x + krawlx | look.i = next.i + krawlx | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
elif look.y < 0 or look.y >= QUADSIZE: | elif look.j < 0 or look.j >= QUADSIZE: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if krawly == m.y or m.x == 0: | if krawly == m.j or m.i == 0: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
look.y = next.y + krawly | look.j = next.j + krawly | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
elif (game.options & OPTION_RAMMING) and game.quad[look.x][look.y] != IHDOT: | elif (game.options & OPTION_RAMMING) and game.quad[look.i][look.j] != IHDOT: | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if game.quad[look.x][look.y] == game.ship and \ | if game.quad[look.i][look.j] == game.ship and \ | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
if krawlx != m.x and m.y != 0: look.x = next.x + krawlx | if krawlx != m.i and m.j != 0: look.i = next.i + krawlx | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
elif krawly != m.y and m.x != 0: look.y = next.y + krawly | elif krawly != m.j and m.i != 0: look.j = next.j + krawly | def movebaddy(enemy): "Tactical movement for the bad guys." next = coord(); look = coord() irun = False # This should probably be just (game.quadrant in game.state.kcmdr) + (game.state.kscmdr==game.quadrant) if game.skill >= SKILL_EXPERT: nbaddys = (((game.quadrant in game.state.kcmdr)*2 + (game.state.kscmdr==game.quad... |
game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons -= 1 | game.state.galaxy[game.state.kscmdr.i][game.state.kscmdr.j].klingons -= 1 | def movescom(iq, avoid): "Commander movement helper." # Avoid quadrants with bases if we want to avoid Enterprise if not welcoming(iq) or (avoid and iq in game.state.baseq): return True if game.justin and not game.iscate: return True # do the move game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons -= ... |
game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons += 1 | game.state.galaxy[game.state.kscmdr.i][game.state.kscmdr.j].klingons += 1 | def movescom(iq, avoid): "Commander movement helper." # Avoid quadrants with bases if we want to avoid Enterprise if not welcoming(iq) or (avoid and iq in game.state.baseq): return True if game.justin and not game.iscate: return True # do the move game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons -= ... |
game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = None | game.state.galaxy[game.state.kscmdr.i][game.state.kscmdr.j].planet = None | def movescom(iq, avoid): "Commander movement helper." # Avoid quadrants with bases if we want to avoid Enterprise if not welcoming(iq) or (avoid and iq in game.state.baseq): return True if game.justin and not game.iscate: return True # do the move game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons -= ... |
if math.sqrt(idelta.x*idelta.x+idelta.y*idelta.y) > 2.0: | if math.sqrt(idelta.i*idelta.i+idelta.j*idelta.j) > 2.0: | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
idelta.x = game.state.kscmdr.y-game.quadrant.y idelta.y = game.quadrant.x-game.state.kscmdr.x | idelta.i = game.state.kscmdr.j-game.quadrant.j idelta.j = game.quadrant.i-game.state.kscmdr.i | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
if idelta.x==0 or idelta.y==0: | if idelta.i==0 or idelta.j==0: | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
if idelta.x != 0: iq.y = game.state.kscmdr.y + 1 | if idelta.i != 0: iq.j = game.state.kscmdr.j + 1 | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
iq.y = game.state.kscmdr.y - 1 | iq.j = game.state.kscmdr.j - 1 | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
iq.x = game.state.kscmdr.x + 1 | iq.i = game.state.kscmdr.i + 1 | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
iq.x = game.state.kscmdr.x - 1 | iq.i = game.state.kscmdr.i - 1 | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
iq.y = game.state.kscmdr.y | iq.j = game.state.kscmdr.j | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
iq.y = game.state.kscmdr.y + idelta.y iq.x = game.state.kscmdr.x | iq.j = game.state.kscmdr.j + idelta.j iq.i = game.state.kscmdr.i | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
not game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].charted): | not game.state.galaxy[game.state.kscmdr.i][game.state.kscmdr.j].charted): | def supercommander(): "Move the Super Commander." iq = coord(); sc = coord(); ibq = coord(); idelta = coord() basetbl = [] if idebug: prout("== SUPERCOMMANDER") # Decide on being active or passive avoid = ((game.incom - len(game.state.kcmdr) + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*ga... |
if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: id.x = 0; id.y = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = 0 elif game.tholian.kloc... | if game.tholian.kloc.i == 0 and game.tholian.kloc.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.kloc.i == 0 and game.tholian.kloc.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian.kloc.i == QUADSIZE-1 and game.tholian.kloc.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = 0 elif game.tholian.kloc... | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: id.x = 0; id.y = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = QUADSIZE-1 elif game.tholian.kloc.x == QUADS... |
if game.quad[id.x][id.y] not in (IHDOT, IHWEB): | if game.quad[id.i][id.j] not in (IHDOT, IHWEB): | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: id.x = 0; id.y = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = QUADSIZE-1 elif game.tholian.kloc.x == QUADS... |
while here.x != id.x: here.x += delta.x if game.quad[here.x][here.y]==IHDOT: | while here.i != id.i: here.i += delta.i if game.quad[here.i][here.j]==IHDOT: | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: id.x = 0; id.y = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = QUADSIZE-1 elif game.tholian.kloc.x == QUADS... |
while here.y != id.y: here.y += delta.y if game.quad[here.x][here.y]==IHDOT: | while here.j != id.j: here.j += delta.j if game.quad[here.i][here.j]==IHDOT: | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: id.x = 0; id.y = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = QUADSIZE-1 elif game.tholian.kloc.x == QUADS... |
game.quad[game.tholian.kloc.x][game.tholian.kloc.y]=IHWEB | game.quad[game.tholian.kloc.i][game.tholian.kloc.j]=IHWEB | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: id.x = 0; id.y = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: id.x = QUADSIZE-1; id.y = QUADSIZE-1 elif game.tholian.kloc.x == QUADS... |
bigger = max(abs(delta.x), abs(delta.y)) | bigger = max(abs(delta.i), abs(delta.j)) | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
x = origin.x; y = origin.y | x = origin.i; y = origin.j | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
x += delta.x y += delta.y | x += delta.i y += delta.j | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
if not VALID_SECTOR(w.x, w.y): | if not VALID_SECTOR(w.i, w.j): | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
iquad=game.quad[w.x][w.y] | iquad=game.quad[w.i][w.j] | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
jw.x = int(w.x+xx+0.5) jw.y = int(w.y+yy+0.5) if not VALID_SECTOR(jw.x, jw.y): | jw.i = int(w.i+xx+0.5) jw.j = int(w.j+yy+0.5) if not VALID_SECTOR(jw.i, jw.j): | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
if game.quad[jw.x][jw.y]==IHBLANK: | if game.quad[jw.i][jw.j]==IHBLANK: | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
if game.quad[jw.x][jw.y]!=IHDOT: | if game.quad[jw.i][jw.j]!=IHDOT: | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
game.quad[w.x][w.y]=IHDOT | game.quad[w.i][w.j]=IHDOT | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase -= 1 game.state.chart[game.quadrant.x][game.quadrant.y].starbase -= 1 | game.state.galaxy[game.quadrant.i][game.quadrant.j].starbase -= 1 game.state.chart[game.quadrant.i][game.quadrant.j].starbase -= 1 | def torpedo(origin, course, dispersion, number, nburst): "Let a photon torpedo fly" shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 delta = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(delta.x), abs(delta.y)) delta /= bigger x = origin.x; y = or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.