rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
game.state.chart[game.quadrant.x][game.quadrant.y].klingons = game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons game.state.chart[game.quadrant.x][game.quadrant.y].starbase = game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase game.state.chart[game.quadrant.x][game.quadrant.y].stars = game.state.gala... | game.state.chart[game.quadrant.i][game.quadrant.j].klingons = game.state.galaxy[game.quadrant.i][game.quadrant.j].klingons game.state.chart[game.quadrant.i][game.quadrant.j].starbase = game.state.galaxy[game.quadrant.i][game.quadrant.j].starbase game.state.chart[game.quadrant.i][game.quadrant.j].stars = game.state.gala... | 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.char... |
w1.y = int(scanner.real-0.5) | w1.j = int(scanner.real-0.5) | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
w1.x = int(scanner.real-0.5) | w1.i = int(scanner.real-0.5) | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
w2.y = int(scanner.real-0.5) | w2.j = int(scanner.real-0.5) | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
w2.x = int(scanner.real-0.5) | w2.i = int(scanner.real-0.5) | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
if game.quadrant.y>w1.x: w2.x = 0 | if game.quadrant.j>w1.i: w2.i = 0 | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
w2.x=QUADSIZE-1 if game.quadrant.x>w1.y: w2.y = 0 | w2.i=QUADSIZE-1 if game.quadrant.i>w1.j: w2.j = 0 | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
w2.y=QUADSIZE-1 if not VALID_QUADRANT(w1.x, w1.y) or not VALID_SECTOR(w2.x, w2.y): | w2.j=QUADSIZE-1 if not VALID_QUADRANT(w1.i, w1.j) or not VALID_SECTOR(w2.i, w2.j): | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
game.dist = math.sqrt((w1.y-game.quadrant.y+0.1*(w2.y-game.sector.y))**2+ (w1.x-game.quadrant.x+0.1*(w2.x-game.sector.x))**2) | game.dist = math.sqrt((w1.j-game.quadrant.j+0.1*(w2.j-game.sector.j))**2+ (w1.i-game.quadrant.i+0.1*(w2.i-game.sector.i))**2) | def eta(): "Use computer to get estimated time of arrival for a warp jump." w1 = coord(); w2 = coord() prompt = False if damaged(DCOMPTR): prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR.")) skip(1) return if scanner.next() != IHREAL: prompt = True scanner.chew() proutn(_("Destination quadrant and/or sector? ")) if ... |
if not game.state.galaxy[w.x][w.y].starbase: | if not game.state.galaxy[w.i][w.j].starbase: | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
game.state.galaxy[w.x][w.y].starbase = game.state.chart[w.x][w.y].starbase = True | game.state.galaxy[w.i][w.j].starbase = game.state.chart[w.i][w.j].starbase = True | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
if not game.state.galaxy[w.x][w.y].supernova and \ game.state.galaxy[w.x][w.y].klingons + klump <= MAXKLQUAD: | if not game.state.galaxy[w.i][w.j].supernova and \ game.state.galaxy[w.i][w.j].klingons + klump <= MAXKLQUAD: | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
game.state.galaxy[w.x][w.y].klingons += int(klump) | game.state.galaxy[w.i][w.j].klingons += int(klump) | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
if (game.state.galaxy[w.x][w.y].klingons or withprob(0.25)): | if (game.state.galaxy[w.i][w.j].klingons or withprob(0.25)): | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
game.state.galaxy[w.x][w.y].klingons += 1 | game.state.galaxy[w.i][w.j].klingons += 1 | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
if game.state.galaxy[w.x][w.y].planet == None: | if game.state.galaxy[w.i][w.j].planet == None: | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
game.state.galaxy[w.x][w.y].planet = new | game.state.galaxy[w.i][w.j].planet = new | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
game.state.galaxy[w.x][w.y].romulans += 1 | game.state.galaxy[w.i][w.j].romulans += 1 | def setup(): "Prepare to play, set up cosmos." w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False... |
if game.quad[w.x][w.y] == IHDOT: | if game.quad[w.i][w.j] == IHDOT: | def dropin(iquad=None): "Drop a feature on a random dot in the current quadrant." while True: w = randplace(QUADSIZE) if game.quad[w.x][w.y] == IHDOT: break if iquad is not None: game.quad[w.x][w.y] = iquad return w |
game.quad[w.x][w.y] = iquad | game.quad[w.i][w.j] = iquad | def dropin(iquad=None): "Drop a feature on a random dot in the current quadrant." while True: w = randplace(QUADSIZE) if game.quad[w.x][w.y] == IHDOT: break if iquad is not None: game.quad[w.x][w.y] = iquad return w |
if game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons or game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans: | if game.state.galaxy[game.quadrant.i][game.quadrant.j].klingons or game.state.galaxy[game.quadrant.i][game.quadrant.j].romulans: | def newcnd(): "Update our alert status." game.condition = "green" if game.energy < 1000.0: game.condition = "yellow" if game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons or game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans: game.condition = "red" if not game.alive: game.condition="dead" |
q = game.state.galaxy[game.quadrant.x][game.quadrant.y] | q = game.state.galaxy[game.quadrant.i][game.quadrant.j] | def newqad(): "Set up a new state of quadrant, for when we enter or re-enter it." game.justin = True game.iplnet = None game.neutz = game.inorbit = game.landed = False game.ientesc = game.iseenit = False # Create a blank quadrant game.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) if game.iscate: # Attempt to escape Super... |
game.quad[game.sector.x][game.sector.y] = game.ship | game.quad[game.sector.i][game.sector.j] = game.ship | def newqad(): "Set up a new state of quadrant, for when we enter or re-enter it." game.justin = True game.iplnet = None game.neutz = game.inorbit = game.landed = False game.ientesc = game.iseenit = False # Create a blank quadrant game.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) if game.iscate: # Attempt to escape Super... |
game.quad[e.kloc.x][e.kloc.y] = IHC | game.quad[e.kloc.i][e.kloc.j] = IHC | def newqad(): "Set up a new state of quadrant, for when we enter or re-enter it." game.justin = True game.iplnet = None game.neutz = game.inorbit = game.landed = False game.ientesc = game.iseenit = False # Create a blank quadrant game.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) if game.iscate: # Attempt to escape Super... |
game.quad[e.kloc.x][e.kloc.y] = IHS | game.quad[e.kloc.i][e.kloc.j] = IHS | def newqad(): "Set up a new state of quadrant, for when we enter or re-enter it." game.justin = True game.iplnet = None game.neutz = game.inorbit = game.landed = False game.ientesc = game.iseenit = False # Create a blank quadrant game.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) if game.iscate: # Attempt to escape Super... |
w.x = withprob(0.5) * (QUADSIZE-1) w.y = withprob(0.5) * (QUADSIZE-1) if game.quad[w.x][w.y] == IHDOT: | w.i = withprob(0.5) * (QUADSIZE-1) w.j = withprob(0.5) * (QUADSIZE-1) if game.quad[w.i][w.j] == IHDOT: | def newqad(): "Set up a new state of quadrant, for when we enter or re-enter it." game.justin = True game.iplnet = None game.neutz = game.inorbit = game.landed = False game.ientesc = game.iseenit = False # Create a blank quadrant game.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) if game.iscate: # Attempt to escape Super... |
if not commands[cmd] or (commands[key] & game.options): | if not commands[key] or (commands[key] & game.options): | def listCommands(): "Generate a list of legal commands." proutn(_("LEGAL COMMANDS ARE:")) for (k, key) in enumerate(commands): if not commands[cmd] or (commands[key] & game.options): if k % 5 == 0: skip(1) proutn("%-12s " % key) skip(1) |
if game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova: | if game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova: | def makemoves(): "Command-interpretation loop." clrscr() setwnd(message_window) while True: # command loop drawmaps(1) while True: # get a command hitme = False game.justin = False game.optime = 0.0 scanner.chew() setwnd(prompt_window) clrscr() proutn("COMMAND> ") if scanner.next() == IHEOL: if game.options & OPTION_C... |
w.x = randrange(size) w.y = randrange(size) | w.i = randrange(size) w.j = randrange(size) | def randplace(size): "Choose a random location." w = coord() w.x = randrange(size) w.y = randrange(size) return w |
s.x = scanner.int()-1 | s.i = scanner.int()-1 | def getcoord(self): s = coord() scanner.next() if scanner.type != IHREAL: huh() return None |
s.y = scanner.int()-1 | s.j = scanner.int()-1 | def getcoord(self): s = coord() scanner.next() if scanner.type != IHREAL: huh() return None |
w.x = int(round(scanner.real)) | w.i = int(round(scanner.real)) | 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] > ... |
w.y = int(round(scanner.real)) | w.j = int(round(scanner.real)) | 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] > ... |
game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova = True | game.state.galaxy[game.quadrant.i][game.quadrant.j].supernova = True | 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] > ... |
return "<%s=%f>" % (self.kloc, self.kpower) | return "<%s,%s.%f>" % (self.type, self.kloc, self.kpower) | def __repr__(self): return "<%s=%f>" % (self.kloc, self.kpower) # For debugging |
proutn(_(" encounters Tholian web at %s;") % w) | prout(_(" encounters Tholian web at %s;") % w) | def no_quad_change(): # No quadrant change -- compute new average enemy distances game.quad[game.sector.x][game.sector.y] = game.ship if game.enemies: for enemy in game.enemies: finald = (w-enemy.kloc).distance() enemy.kavgd = 0.5 * (finald + enemy.kdist) enemy.kdist = finald game.enemies.sort(lambda x, y: cmp(x.kdist,... |
proutn(_(" blocked by object at %s;") % w) | prout(_(" blocked by object at %s;") % w) | def no_quad_change(): # No quadrant change -- compute new average enemy distances game.quad[game.sector.x][game.sector.y] = game.ship if game.enemies: for enemy in game.enemies: finald = (w-enemy.kloc).distance() enemy.kavgd = 0.5 * (finald + enemy.kdist) enemy.kdist = finald game.enemies.sort(lambda x, y: cmp(x.kdist,... |
final.x = x-deltax+0.5 final.y = y-deltay+0.5 | final.x = int(round(deltax)) final.y = int(round(deltay)) | def no_quad_change(): # No quadrant change -- compute new average enemy distances game.quad[game.sector.x][game.sector.y] = game.ship if game.enemies: for enemy in game.enemies: finald = (w-enemy.kloc).distance() enemy.kavgd = 0.5 * (finald + enemy.kdist) enemy.kdist = finald game.enemies.sort(lambda x, y: cmp(x.kdist,... |
if not welcoming(w): | if welcoming(w): | def setup(): # prepare to play, set up cosmos w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False ... |
for i in range(game.klhere, len(game.enemies)): | for i in range(q.romulans): | def newqad(shutup): # set up a new state of quadrant, for when we enter or re-enter it w = coord() game.justin = True game.klhere = 0 game.irhere = 0 game.iplnet = 0 game.neutz = False game.inorbit = False game.landed = False game.ientesc = False game.iseenit = False # Create a blank quadrant game.quad = fill2d(QUADSIZ... |
"SEED": 0, "VISUAL": 0, | def setpassword(): # set the self-destruct password if game.options & OPTION_PLAIN: while True: scanner.chew() proutn(_("Please type in a secret password- ")) scanner.next() game.passwd = scanner.token if game.passwd != None: break else: game.passwd = "" for i in range(8): game.passwd += chr(ord('a')+randrange(26)) | |
(options, arguments) = getopt.getopt(sys.argv[1:], "r:tx") | (options, arguments) = getopt.getopt(sys.argv[1:], "r:s:tx") | 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... |
scanner.token = "emsave.trk" else: | scanner.push("emsave.trk") key = scanner.next() if key == "IHEOL": proutn(_("File name: ")) | def freeze(boss): "Save game." if boss: scanner.token = "emsave.trk" else: key = scanner.next() if key == "IHEOL": proutn(_("File name: ")) key = scanner.next() if key != "IHALPHA": huh() return scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" try: fp = open(scanner.token, "wb") except IOError: prout... |
if key == "IHEOL": proutn(_("File name: ")) key = scanner.next() if key != "IHALPHA": huh() return scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" | if key != "IHALPHA": huh() return scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" | def freeze(boss): "Save game." if boss: scanner.token = "emsave.trk" else: key = scanner.next() if key == "IHEOL": proutn(_("File name: ")) key = scanner.next() if key != "IHALPHA": huh() return scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" try: fp = open(scanner.token, "wb") except IOError: prout... |
elif scanner.sees("fancy"): | elif scanner.sees("fancy") or scanner.sees("\n"): | def choose(): "Choose your game type." global thing while True: game.tourn = 0 game.thawed = False game.skill = SKILL_NONE game.length = 0 if not scanner.inqueue: # Can start with command line options proutn(_("Would you like a regular, tournament, or saved game? ")) scanner.next() if scanner.sees("tournament"): while ... |
self.inqueue = line.lstrip().split() + ["IHEOL"] | self.inqueue = line.lstrip().split() + ["\n"] | def next(self): # Get a token from the user self.real = 0.0 self.token = '' # Fill the token quue if nothing here while not self.inqueue: line = cgetline() if curwnd==prompt_window: clrscr() setwnd(message_window) clrscr() if line == '': return None if not line: continue else: self.inqueue = line.lstrip().split() + ["I... |
if self.token == "IHEOL": | if self.token == "\n": | def next(self): # Get a token from the user self.real = 0.0 self.token = '' # Fill the token quue if nothing here while not self.inqueue: line = cgetline() if curwnd==prompt_window: clrscr() setwnd(message_window) clrscr() if line == '': return None if not line: continue else: self.inqueue = line.lstrip().split() + ["I... |
proutn(" retreats to sector %s" % ship.location) | prout(" retreats to sector %s" % ship.location) | def movebaddy(ship): # tactical movement for the bad guys bugout = False # This should probably be just game.comhere + game.ishere if game.skill >= SKILL_EXPERT: nbaddys = int((game.comhere*2 + game.ishere*2+game.klhere*1.23+game.irhere*1.5)/2.0) else: nbaddys = game.comhere + game.ishere dist1 = ship.distance() mdist ... |
return coord(self.x-self.x, self.y-self.y) | return coord(self.x-other.x, self.y-other.y) | def __sub__(self, other): return coord(self.x-self.x, self.y-self.y) |
game.quad[self.kloc.x][self.kloc.y] = IHDOT | 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 | def move(self, loc): motion = (loc != self.kloc) if self.kloc.x is not None and self.kloc.y is not None: game.quad[self.kloc.x][self.kloc.y] = IHDOT if loc: self.kloc = loc game.quad[self.kloc.x][self.kloc.y] = self.type self.kdist = self.kavgd = distance(game.sector, loc) else: self.kloc = coord() # enemy sector locat... |
self.kloc = loc | self.kloc = copy.copy(loc) | def move(self, loc): motion = (loc != self.kloc) if self.kloc.x is not None and self.kloc.y is not None: game.quad[self.kloc.x][self.kloc.y] = IHDOT if loc: self.kloc = loc game.quad[self.kloc.x][self.kloc.y] = self.type self.kdist = self.kavgd = distance(game.sector, loc) else: self.kloc = coord() # enemy sector locat... |
idx = 0; idy = QUADSIZE-1 | id.x = 0; id.y = QUADSIZE-1 | def movetholian(): # move the Tholian if not game.tholian or game.justin: return if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: idx = 0; idy = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: idx = QUADSIZE-1; idy = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tho... |
idx = QUADSIZE-1; idy = QUADSIZE-1 | id.x = QUADSIZE-1; id.y = QUADSIZE-1 | def movetholian(): # move the Tholian if not game.tholian or game.justin: return if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: idx = 0; idy = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: idx = QUADSIZE-1; idy = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tho... |
idx = QUADSIZE-1; idy = 0 | id.x = QUADSIZE-1; id.y = 0 | def movetholian(): # move the Tholian if not game.tholian or game.justin: return if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: idx = 0; idy = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: idx = QUADSIZE-1; idy = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tho... |
idx = 0; idy = 0 | id.x = 0; id.y = 0 | def movetholian(): # move the Tholian if not game.tholian or game.justin: return if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: idx = 0; idy = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: idx = QUADSIZE-1; idy = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tho... |
game.tholian = None | game.tholian.move(None) prout("***Internal error: Tholian in a bad spot.") | def movetholian(): # move the Tholian if not game.tholian or game.justin: return if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: idx = 0; idy = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: idx = QUADSIZE-1; idy = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tho... |
if game.quad[idx][idy]!= IHDOT and game.quad[idx][idy]!= IHWEB: return game.quad[game.tholian.kloc.x][game.tholian.kloc.y] = IHWEB if game.tholian.kloc.x != idx: im = math.fabs(idx - game.tholian.kloc.x)*1.0/(idx - game.tholian.kloc.x) while game.tholian.kloc.x != idx: game.tholian.kloc.x += im if game.quad[game.tholi... | if game.quad[id.x][id.y] not in (IHDOT, IHWEB): return here = copy.copy(game.tholian.kloc) delta = (id - game.tholian.kloc).sgn() while here.x != id.x: here.x += delta.x if game.quad[here.kloc.x][here.y]==IHDOT: game.tholian.move(here) while here.y != id.y: here.y += delta.y if game.quad[here.x][here.y]==IHDOT: gam... | def movetholian(): # move the Tholian if not game.tholian or game.justin: return if game.tholian.kloc.x == 0 and game.tholian.kloc.y == 0: idx = 0; idy = QUADSIZE-1 elif game.tholian.kloc.x == 0 and game.tholian.kloc.y == QUADSIZE-1: idx = QUADSIZE-1; idy = QUADSIZE-1 elif game.tholian.kloc.x == QUADSIZE-1 and game.tho... |
if damaged(DSRSENS) and not (abs(game.sector.x-aim.x) < 2 and abs(game.sector.y-aim.y) < 2) and \ (ienm == IHC or ienm == IHS): | if damaged(DSRSENS) and \ not game.sector.distance(aim)<2**0.5 and ienm in (IHC, IHS): | def phasers(): # fire phasers hits = [] kz = 0; k = 1; irec=0 # Cheating inhibitor ifast = False; no = False; itarg = True; msgflag = True; rpow=0 automode = "NOTSET" key=0 skip(1) # SR sensors and Computer are needed fopr automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == "docked": pr... |
scan() | print "About to call scan()" | 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... |
os.wait() | wait() | 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... |
line = raw_input() | line = raw_input("COMMAND> ") | def cgetline(): "Get a line of input." if game.options & OPTION_CURSES: line = curwnd.getstr() + "\n" curwnd.refresh() else: if replayfp and not replayfp.closed: line = replayfp.readline() else: line = raw_input() if logfp: logfp.write(line + "\n") return line |
proutn("COMMAND> ") | 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... | |
elif cmd == "SEED": key = scan() if key == IHREAL: 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... | |
krawlx = 1 | krawli = 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... |
krawlx = -1 | krawli = -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... |
krawly = 1 | krawlj = 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... |
krawly = -1 | krawlj = -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 krawlx == m.i or m.j == 0: | if krawli == 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.i = next.i + krawlx krawlx = -krawlx | look.i = next.i + krawli krawli = -krawli | 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.j or m.i == 0: | if krawlj == 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.j = next.j + krawly krawly = -krawly | look.j = next.j + krawlj krawlj = -krawlj | 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.i and m.j != 0: look.i = next.i + krawlx krawlx = -krawlx elif krawly != m.j and m.i != 0: look.j = next.j + krawly krawly = -krawly | if krawli != m.i and m.j != 0: look.i = next.i + krawli krawli = -krawli elif krawlj != m.j and m.i != 0: look.j = next.j + krawlj krawlj = -krawlj | 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... |
supernova(False) | supernova(None) | def destroybase(): "Code merges here for any commander destroying a starbase." # Not perfect, but will have to do # Handle case where base is in same quadrant as starship if game.battle == game.quadrant: game.state.chart[game.battle.i][game.battle.j].starbase = False game.quad[game.base.i][game.base.j] = IHDOT game.bas... |
supernova(True, game.probec) | supernova(game.probec) | def destroybase(): "Code merges here for any commander destroying a starbase." # Not perfect, but will have to do # Handle case where base is in same quadrant as starship if game.battle == game.quadrant: game.state.chart[game.battle.i][game.battle.j].starbase = False game.quad[game.base.i][game.base.j] = IHDOT game.bas... |
supernova(False, nov) | supernova(game.quadrant) | def nova(nov): "Star goes nova." course = (0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5) newc = coord(); neighbor = coord(); bump = coord(0, 0) if withprob(0.05): # Wow! We've supernova'ed supernova(False, nov) return # handle initial nova game.quad[nov.i][nov.j] = IHDOT prout(crmena(False, IHSTAR, "sector", nov)... |
supernova(False) | supernova(game.quadrant) | def nova(nov): "Star goes nova." course = (0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5) newc = coord(); neighbor = coord(); bump = coord(0, 0) if withprob(0.05): # Wow! We've supernova'ed supernova(False, nov) return # handle initial nova game.quad[nov.i][nov.j] = IHDOT prout(crmena(False, IHSTAR, "sector", nov)... |
def supernova(induced, w=None): | def supernova(w): | def supernova(induced, w=None): "Star goes supernova." num = 0; npdead = 0 nq = coord() if w != None: nq = w else: stars = 0 # Scheduled supernova -- select star # logic changed here so that we won't favor quadrants in top # left of universe for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.ga... |
nq = coord() | def supernova(induced, w=None): "Star goes supernova." num = 0; npdead = 0 nq = coord() if w != None: nq = w else: stars = 0 # Scheduled supernova -- select star # logic changed here so that we won't favor quadrants in top # left of universe for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.ga... | |
nq = w | nq = copy.copy(w) | def supernova(induced, w=None): "Star goes supernova." num = 0; npdead = 0 nq = coord() if w != None: nq = w else: stars = 0 # Scheduled supernova -- select star # logic changed here so that we won't favor quadrants in top # left of universe for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.ga... |
nq = coord() | def supernova(induced, w=None): "Star goes supernova." num = 0; npdead = 0 nq = coord() if w != None: nq = w else: stars = 0 # Scheduled supernova -- select star # logic changed here so that we won't favor quadrants in top # left of universe for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.ga... | |
if induced: | if w != None: | def supernova(induced, w=None): "Star goes supernova." num = 0; npdead = 0 nq = coord() if w != None: nq = w else: stars = 0 # Scheduled supernova -- select star # logic changed here so that we won't favor quadrants in top # left of universe for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.ga... |
if not induced: | if w == None: | def supernova(induced, w=None): "Star goes supernova." num = 0; npdead = 0 nq = coord() if w != None: nq = w else: stars = 0 # Scheduled supernova -- select star # logic changed here so that we won't favor quadrants in top # left of universe for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.ga... |
dsect.j = xk dsect.i = xl | dsect.i = xk dsect.j = xl | def getcourse(isprobe, akey): "Get a course and distance from the user." key = 0 dquad = copy.copy(game.quadrant) navmode = "unspecified" itemp = "curt" dsect = coord() iprompt = False if game.landed and not isprobe: prout(_("Dummy! You can't leave standard orbit until you")) proutn(_("are back aboard the ship.")) scan... |
dsect.j = xi dsect.i = xj | dsect.i = xi dsect.j = xj | def getcourse(isprobe, akey): "Get a course and distance from the user." key = 0 dquad = copy.copy(game.quadrant) navmode = "unspecified" itemp = "curt" dsect = coord() iprompt = False if game.landed and not isprobe: prout(_("Dummy! You can't leave standard orbit until you")) proutn(_("are back aboard the ship.")) scan... |
if not VALID_QUADRANT(dquad.j,dquad.i) or not VALID_SECTOR(dsect.i,dsect.j): | if not VALID_QUADRANT(dquad.i,dquad.j) or not VALID_SECTOR(dsect.i,dsect.j): | def getcourse(isprobe, akey): "Get a course and distance from the user." key = 0 dquad = copy.copy(game.quadrant) navmode = "unspecified" itemp = "curt" dsect = coord() iprompt = False if game.landed and not isprobe: prout(_("Dummy! You can't leave standard orbit until you")) proutn(_("are back aboard the ship.")) scan... |
delta.i = dquad.j-game.quadrant.j + 0.1*(dsect.i-game.sector.j) delta.j = game.quadrant.i-dquad.i + 0.1*(game.sector.i-dsect.j) | 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) | def getcourse(isprobe, akey): "Get a course and distance from the user." key = 0 dquad = copy.copy(game.quadrant) navmode = "unspecified" itemp = "curt" dsect = coord() iprompt = False if game.landed and not isprobe: prout(_("Dummy! You can't leave standard orbit until you")) proutn(_("are back aboard the ship.")) scan... |
scanner.chew() | def ja(): "Yes-or-no confirmation." scanner.chew() while True: scanner.next() scanner.chew() if scanner.token == 'y': return True if scanner.token == 'n': return False proutn(_("Please answer with \"y\" or \"n\": ")) | |
return other != None and self.x == other.y and self.x == other.y | return other != None and self.x == other.y and self.y == other.y | def __eq__(self, other): return other != None and self.x == other.y and self.x == other.y |
delta.y = 0.1*(w.y - game.sector.y); delta.x = 0.1*(game.sector.x - w.x); | delta.y = (w.y - game.sector.y); delta.x = (game.sector.x - w.x); | def targetcheck(w): "Return None if target is invalid, otherwise return a course angle." if not VALID_SECTOR(w.x, w.y): huh() return None delta = coord() # FIXME: C code this was translated from is wacky -- why the sign reversal? delta.y = 0.1*(w.y - game.sector.y); delta.x = 0.1*(game.sector.x - w.x); if delta == coor... |
self.stars = None | self.stars = 0 | def __init__(self): self.stars = None self.planet = None |
self.starbase = None self.klingons = None self.romulans = None self.supernova = None self.charted = None self.status = None | self.starbase = False self.klingons = 0 self.romulans = 0 self.supernova = False self.charted = False self.status = "secure" | def __init__(self): self.stars = None self.planet = None |
if not game.plnet.is_valid() or abs(game.sector.x-game.plnet.x) > 1 or abs(game.sector.y-game.plnet.y) > 1: | if not game.plnet.is_valid(): prout("There is no planet in this sector.") return if abs(game.sector.x-game.plnet.x)>1 or abs(game.sector.y-game.plnet.y)>1: | def orbit(): # enter standard orbit skip(1) scanner.chew() if game.inorbit: prout(_("Already in standard orbit.")) return if damaged(DWARPEN) and damaged(DIMPULS): prout(_("Both warp and impulse engines damaged.")) return if not game.plnet.is_valid() or abs(game.sector.x-game.plnet.x) > 1 or abs(game.sector.y-game.plne... |
for i in range(GALSIZE): for j in range(GALSIZE): quad = game.state.galaxy[i][j] quad.charted = 0 quad.planet = None quad.romulans = 0 quad.klingons = 0 quad.starbase = False quad.supernova = False quad.status = "secure" | def setup(): # prepare to play, set up cosmos w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False ... | |
game.state.galaxy[w.x][w.y].starbase = True game.state.chart[w.x][w.y].starbase = True | game.state.galaxy[w.x][w.y].starbase = game.state.chart[w.x][w.y].starbase = True | def setup(): # prepare to play, set up cosmos w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False ... |
if (game.state.galaxy[w.x][w.y].klingons or withprob(0.25)) and \ not game.state.galaxy[w.x][w.y].supernova and \ game.state.galaxy[w.x][w.y].klingons <= MAXKLQUAD-1 and \ not w in game.state.kcmdr[:i]: | if not welcoming(w) or w in game.state.kcmdr: continue if (game.state.galaxy[w.x][w.y].klingons or withprob(0.25)): | def setup(): # prepare to play, set up cosmos w = coord() # Decide how many of everything if choose(): return # frozen game # Prepare the Enterprise game.alldone = game.gamewon = False game.ship = IHE game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld = 2500.0 game.shldchg = False ... |
for i in range(3): | for i in range(8): | def setpassword(): # set the self-destruct password if game.options & OPTION_PLAIN: while True: scanner.chew() proutn(_("Please type in a secret password- ")) scanner.next() game.passwd = scanner.token if game.passwd != None: break else: game.passwd = "" for i in range(3): game.passwd += chr(ord('a')+randrange(26)) |
IHEOL = '\n' IHREAL = 0.0 IHALPHA = " " | def VALID_SECTOR(x, y): return ((x)>=0 and (x)<QUADSIZE and (y)>=0 and (y)<QUADSIZE) | |
if key == IHALPHA: | if key == "IHALPHA": | def doshield(shraise): "Change shield status." action = "NONE" game.ididit = False if shraise: action = "SHUP" else: key = scanner.next() if key == IHALPHA: if scanner.sees("transfer"): action = "NRG" else: if damaged(DSHIELD): prout(_("Shields damaged and down.")) return if scanner.sees("up"): action = "SHUP" elif sca... |
while scanner.next() != IHREAL: | while scanner.next() != "IHREAL": | def doshield(shraise): "Change shield status." action = "NONE" game.ididit = False if shraise: action = "SHUP" else: key = scanner.next() if key == IHALPHA: if scanner.sees("transfer"): action = "NRG" else: if damaged(DSHIELD): prout(_("Shields damaged and down.")) return if scanner.sees("up"): action = "SHUP" elif sca... |
if scanner.token == IHALPHA: | if scanner.token == "IHALPHA": | def photon(): "Launch photon torpedo." course = [] game.ididit = False if damaged(DPHOTON): prout(_("Photon tubes damaged.")) scanner.chew() return if game.torps == 0: prout(_("No torpedoes left.")) scanner.chew() return # First, get torpedo count while True: scanner.next() if scanner.token == IHALPHA: huh() return eli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.