rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
elif scanner.token == IHEOL or not scanner.waiting(): | elif scanner.token == "IHEOL" or not scanner.waiting(): | 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... |
if i==0 and key == IHEOL: | if i==0 and key == "IHEOL": | 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... |
if i==1 and key == IHEOL: | if i==1 and key == "IHEOL": | 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... |
if key == IHALPHA: | if key == "IHALPHA": | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
key = IHEOL | key = "IHEOL" | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
elif key == IHREAL: | elif key == "IHREAL": | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
if key == IHALPHA and scanner.sees("no"): | if key == "IHALPHA" and scanner.sees("no"): | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
if key != IHREAL and len(game.enemies) != 0: | if key != "IHREAL" and len(game.enemies) != 0: | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
if key!=IHREAL: | if key!="IHREAL": | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
if key == IHEOL: | if key == "IHEOL": | def phasers(): "Fire phasers at bad guys." 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == ... |
if key != IHEOL: | if key != "IHEOL": | def wait(): "Wait on events." game.ididit = False while True: key = scanner.next() if key != IHEOL: break proutn(_("How long? ")) scanner.chew() if key != IHREAL: huh() return origTime = delay = scanner.real if delay <= 0.0: return if delay >= game.state.remtime or len(game.enemies) != 0: proutn(_("Are you sure? ")) i... |
if key != IHREAL: | if key != "IHREAL": | def wait(): "Wait on events." game.ididit = False while True: key = scanner.next() if key != IHEOL: break proutn(_("How long? ")) scanner.chew() if key != IHREAL: huh() return origTime = delay = scanner.real if delay <= 0.0: return if delay >= game.state.remtime or len(game.enemies) != 0: proutn(_("Are you sure? ")) i... |
key = IHEOL | key = "IHEOL" | 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 key == IHEOL: | if key == "IHEOL": | 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... |
elif key == IHALPHA: | elif key == "IHALPHA": | 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... |
while key == IHEOL: | while key == "IHEOL": | 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 key != IHREAL: | if key != "IHREAL": | 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 key == IHREAL: | if key == "IHREAL": | 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 key != IHEOL: | if key != "IHEOL": | def setwarp(): "Change the warp factor." while True: key=scanner.next() if key != IHEOL: break scanner.chew() proutn(_("Warp factor- ")) scanner.chew() if key != IHREAL: huh() return if game.damage[DWARPEN] > 10.0: prout(_("Warp engines inoperative.")) return if damaged(DWARPEN) and scanner.real > 4.0: prout(_("Enginee... |
if key != IHREAL: | if key != "IHREAL": | def setwarp(): "Change the warp factor." while True: key=scanner.next() if key != IHEOL: break scanner.chew() proutn(_("Warp factor- ")) scanner.chew() if key != IHREAL: huh() return if game.damage[DWARPEN] > 10.0: prout(_("Warp engines inoperative.")) return if damaged(DWARPEN) and scanner.real > 4.0: prout(_("Enginee... |
if key == IHEOL: | if key == "IHEOL": | def probe(): "Launch deep-space probe." # New code to launch a deep space probe if game.nprobes == 0: scanner.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): scanner.chew() s... |
if key == IHALPHA and scanner.token == "armed": | if key == "IHALPHA" and scanner.token == "armed": | def probe(): "Launch deep-space probe." # New code to launch a deep space probe if game.nprobes == 0: scanner.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): scanner.chew() s... |
elif key == IHEOL: | elif key == "IHEOL": | def probe(): "Launch deep-space probe." # New code to launch a deep space probe if game.nprobes == 0: scanner.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): scanner.chew() s... |
while scanner.next() == IHEOL: | while scanner.next() == "IHEOL": | def request(): "Request specified status data, a historical relic from slow TTYs." requests = ("da","co","po","ls","wa","en","to","sh","kl","sy", "ti") while scanner.next() == IHEOL: proutn(_("Information desired? ")) scanner.chew() if scanner.token in requests: status(requests.index(scanner.token)) else: prout(_("UNRE... |
if scanner.next() != IHREAL: | if scanner.next() != "IHREAL": | 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 scanner.next() == IHREAL: | if scanner.next() == "IHREAL": | 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 key == IHEOL: | if key == "IHEOL": | 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 != IHALPHA: | if key != "IHALPHA": | 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: | if key == "IHEOL": | def thaw(): "Retrieve saved game." game.passwd[0] = '\0' key = scanner.next() if key == IHEOL: proutn(_("File name: ")) key = scanner.next() if key != IHALPHA: huh() return True scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" try: fp = open(scanner.token, "rb") except IOError: prout(_("Can't thaw ga... |
if key != IHALPHA: | if key != "IHALPHA": | def thaw(): "Retrieve saved game." game.passwd[0] = '\0' key = scanner.next() if key == IHEOL: proutn(_("File name: ")) key = scanner.next() if key != IHALPHA: huh() return True scanner.chew() if '.' not in scanner.token: scanner.token += ".trk" try: fp = open(scanner.token, "rb") except IOError: prout(_("Can't thaw ga... |
while scanner.next() == IHEOL: | while scanner.next() == "IHEOL": | 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 len(scanner.token)==0: # Try again... |
if scanner.next() == IHALPHA: | if scanner.next() == "IHALPHA": | 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 len(scanner.token)==0: # Try again... |
if scanner.next() != IHALPHA: | if scanner.next() != "IHALPHA": | 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 len(scanner.token)==0: # Try again... |
if key == IHEOL: | if key == "IHEOL": | def helpme(): "Browse on-line help." key = scanner.next() while True: if key == IHEOL: setwnd(prompt_window) proutn(_("Help on what command? ")) key = scanner.next() setwnd(message_window) if key == IHEOL: return if scanner.token in commands or scanner.token == "ABBREV": break skip(1) listCommands() key = IHEOL scanner... |
key = IHEOL | key = "IHEOL" | def helpme(): "Browse on-line help." key = scanner.next() while True: if key == IHEOL: setwnd(prompt_window) proutn(_("Help on what command? ")) key = scanner.next() setwnd(message_window) if key == IHEOL: return if scanner.token in commands or scanner.token == "ABBREV": break skip(1) listCommands() key = IHEOL scanner... |
if scanner.next() == IHEOL: | if scanner.next() == "IHEOL": | 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... |
self.inqueue = line.lstrip().split() + [IHEOL] | self.inqueue = line.lstrip().split() + ["IHEOL"] | 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 # Skip leading white space line = line.lstrip() if not line: continue ... |
if self.token == IHEOL: self.type = IHEOL return IHEOL | if self.token == "IHEOL": self.type = "IHEOL" return "IHEOL" | 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 # Skip leading white space line = line.lstrip() if not line: continue ... |
self.type = IHREAL return IHREAL | self.type = "IHREAL" return "IHREAL" | 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 # Skip leading white space line = line.lstrip() if not line: continue ... |
self.type = IHALPHA | self.type = "IHALPHA" | 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 # Skip leading white space line = line.lstrip() if not line: continue ... |
return IHALPHA | return "IHALPHA" | 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 # Skip leading white space line = line.lstrip() if not line: continue ... |
self.inqueue = [IHEOL] | self.inqueue = ["IHEOL"] | def chew2(self): # return IHEOL next time self.inqueue = [IHEOL] self.real = self.token = None |
if scanner.type != IHREAL: | if scanner.type != "IHREAL": | def getcoord(self): s = coord() scanner.next() if scanner.type != IHREAL: huh() return None |
if key == IHALPHA and scanner.sees("y"): | if key == "IHALPHA" and scanner.sees("y"): | 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] > ... |
elif key == IHREAL: | elif key == "IHREAL": | 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] > ... |
if key != IHEOL: if key != IHREAL: | if key != "IHEOL": if key != "IHREAL": | 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] > ... |
if key != IHREAL: | if key != "IHREAL": | 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] > ... |
print "About to call scan()" | 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? ")) print "About to call scan()" if len(citem)==0: # Try... |
prompt_window.wclear() | prompt_window.clear() | def pause_game(): if game.skill > SKILL_FAIR: prompt = _("[CONTINUE?]") else: prompt = _("[PRESS ENTER TO CONTINUE]") if game.options & OPTION_CURSES: drawmaps(0) setwnd(prompt_window) prompt_window.wclear() prompt_window.addstr(prompt) prompt_window.getstr() prompt_window.clear() prompt_window.refresh() setwnd(messag... |
wclrtoeol(curwnd) wrefresh(curwnd) | curwnd.clrtoeol() curwnd.refresh() | def clreol(): "Clear to end of line -- can be a no-op in tty mode" if game.options & OPTION_CURSES: wclrtoeol(curwnd) wrefresh(curwnd) |
ktr=1 | def fry(hit): # critical-hit resolution ktr=1 # a critical hit occured if hit < (275.0-25.0*game.skill)*randreal(1.0, 1.5): return ncrit = int(1.0 + hit/(500.0+randreal(100))) proutn(_("***CRITICAL HIT--")) # Select devices and cause damage cdam = [] for loop1 in range(ncrit): while True: j = randdevice() # Cheat to pr... | |
if loop1 > 0: for loop2 in range(loop1): if j == cdam[loop2]: break if loop2 < loop1: continue ktr += 1 if ktr==3: skip(1) proutn(_(" and ")) | skipcount = 0 for (i, j) in enumerate(cdam): | def fry(hit): # critical-hit resolution ktr=1 # a critical hit occured if hit < (275.0-25.0*game.skill)*randreal(1.0, 1.5): return ncrit = int(1.0 + hit/(500.0+randreal(100))) proutn(_("***CRITICAL HIT--")) # Select devices and cause damage cdam = [] for loop1 in range(ncrit): while True: j = randdevice() # Cheat to pr... |
proutn(_("Lt. Uhura- \"Captain, the starbase in Quadrant %s") % game.battle) | prout(_("Lt. Uhura- \"Captain, the starbase in Quadrant %s") % game.battle) | def destroybase(): # Code merges here for any commander destroying base # 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.x][game.battle.y].starbase = False game.quad[game.base.x][game.base.y] = IHDOT game.base.x=gam... |
proutn(_(" hold out only until stardate %d") % (int(scheduled(FCDBAS)))) prout(".\"") | prout(_(" hold out only until stardate %d.\"") % (int(scheduled(FCDBAS)))) | def destroybase(): # Code merges here for any commander destroying base # 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.x][game.battle.y].starbase = False game.quad[game.base.x][game.base.y] = IHDOT game.base.x=gam... |
DEFAULT = 0 BLACK = 1 BLUE = 2 GREEN = 3 CYAN = 4 RED = 5 MAGENTA = 6 BROWN = 7 LIGHTGRAY = 8 DARKGRAY = 9 LIGHTBLUE = 10 LIGHTGREEN = 11 LIGHTCYAN = 12 LIGHTRED = 13 LIGHTMAGENTA = 14 YELLOW = 15 WHITE = 16 | def recompute(self): # Stas thinks this should be (C expression): # game.state.remkl + game.state.remcom > 0 ? | |
icas = randrange(hittot * 0.015) | icas = randrange(int(hittot * 0.015)) | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" # game could be over at this point, check if game.alldone: return if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
icas = randrange(hit*0.012) | icas = randrange(int(hit*0.012)) | def checkshctrl(rpow): # check shield control skip(1) if withprob(0.998): prout(_("Shields lowered.")) return False # Something bad has happened prouts(_("***RED ALERT! RED ALERT!")) skip(2) hit = rpow*game.shield/game.inshld game.energy -= rpow+hit*0.8 game.shield -= hit*0.2 if game.energy <= 0.0: prouts(_("Sulu- \"... |
def textcolor(color): "Set the current text color" if game.options & OPTION_CURSES: if color == DEFAULT: curwnd.attrset(0) elif color == BLACK: curwnd.attron(curses.COLOR_PAIR(curses.COLOR_BLACK)) elif color == BLUE: curwnd.attron(curses.COLOR_PAIR(curses.COLOR_BLUE)) elif color == GREEN: curwnd.attron(curses.COLOR_PAI... | def clrscr(): "Clear screen -- can be a no-op in tty mode." global linecount if game.options & OPTION_CURSES: curwnd.clear() curwnd.move(0, 0) curwnd.refresh() linecount = 0 | |
textcolor(RED) | textcolor("red") | def mayday(): # yell for help from nearest starbase # There's more than one way to move in this game! line = 0 chew() # Test for conditions which prevent calling for help if game.condition == "docked": prout(_("Lt. Uhura- \"But Captain, we're already docked.\"")) return if damaged(DRADIO): prout(_("Subspace radio dama... |
textcolor(DEFAULT) | textcolor(None) | def mayday(): # yell for help from nearest starbase # There's more than one way to move in this game! line = 0 chew() # Test for conditions which prevent calling for help if game.condition == "docked": prout(_("Lt. Uhura- \"But Captain, we're already docked.\"")) return if damaged(DRADIO): prout(_("Subspace radio dama... |
textcolor(GREEN) | textcolor("green") | def mayday(): # yell for help from nearest starbase # There's more than one way to move in this game! line = 0 chew() # Test for conditions which prevent calling for help if game.condition == "docked": prout(_("Lt. Uhura- \"But Captain, we're already docked.\"")) return if damaged(DRADIO): prout(_("Subspace radio dama... |
if game.condition == "red": textcolor(RED) elif game.condition == "green": textcolor(GREEN) elif game.condition == "yellow": textcolor(YELLOW) elif game.condition == "docked": textcolor(CYAN) elif game.condition == "dead": textcolor(BROWN) | if game.condition == "red": textcolor("red") elif game.condition == "green": textcolor("green") elif game.condition == "yellow": textcolor("yellow") elif game.condition == "docked": textcolor("cyan") elif game.condition == "dead": textcolor("brown") | def sectscan(goodScan, i, j): # light up an individual dot in a sector if goodScan or (abs(i-game.sector.x)<= 1 and abs(j-game.sector.y) <= 1): if (game.quad[i][j]==IHMATER0) or (game.quad[i][j]==IHMATER1) or (game.quad[i][j]==IHMATER2) or (game.quad[i][j]==IHE) or (game.quad[i][j]==IHF): if game.condition == "red": ... |
textcolor(DEFAULT) | textcolor(None) | def sectscan(goodScan, i, j): # light up an individual dot in a sector if goodScan or (abs(i-game.sector.x)<= 1 and abs(j-game.sector.y) <= 1): if (game.quad[i][j]==IHMATER0) or (game.quad[i][j]==IHMATER1) or (game.quad[i][j]==IHMATER2) or (game.quad[i][j]==IHE) or (game.quad[i][j]==IHF): if game.condition == "red": ... |
game.tholian.x = withprob(0.5) * QUADSIZE game.tholian.y = withprob(0.5) * QUADSIZE | game.tholian.x = withprob(0.5) * (QUADSIZE-1) game.tholian.y = withprob(0.5) * (QUADSIZE-1) | 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.comhere = False game.ishere = False game.irhere = 0 game.iplnet = 0 game.nenhere = 0 game.neutz = False game.inorbit = False game.landed = False game.ientesc = False global iqengry ... |
raise SysExit, 1 | raise SystemExit, 1 | 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... |
seed = int(seed) sys.stderr.write("sst2k: seed set to %d\n" % seed) | seed = eval(seed) sys.stderr.write("sst2k: seed set to %s\n" % seed) | 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... |
raise SysExit, 0 | raise SystemExit, 0 | 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... |
return other != None and self.x == other.y and self.y == other.y | return other != None and self.x == other.x and self.y == other.y | def __eq__(self, other): return other != None and self.x == other.y and self.y == other.y |
elif iquad in (IHC, IHS): | elif iquad in (IHC, IHS, IHR, IHK): | 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.i), abs(delta.j)) delta /= bigger x = origin.i; y = or... |
elif iquad in (IHR, IHK): | 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.i), abs(delta.j)) delta /= bigger x = origin.i; y = or... | |
raise "foundit" except "foundit": schedule(FBATTAK, expran(0.3*game.intime)) unschedule(FCDBAS) continue | raise ibq else: schedule(FBATTAK, expran(0.3*game.intime)) unschedule(FCDBAS) continue except coord: pass | 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... |
game.enemies[ll].kdist = game.enemies[ll].kavgd = (game.sector-game.enemies[ll]).kloc.distance() | game.enemies[ll].kdist = game.enemies[ll].kavgd = (game.sector-game.enemies[ll].kloc).distance() | def torpedo(course, dispersion, origin, number, nburst): # let a photon torpedo fly iquad = 0 shoved = False ac = course + 0.25*dispersion angle = (15.0-ac)*0.5235988 bullseye = (15.0 - course)*0.5235988 deltax = -math.sin(angle); deltay = math.cos(angle); x = origin.x; y = origin.y w = coord(); jw = coord() w.x = w.y ... |
dustfac = 0.8 + randreal(0.5) | dustfac = randreal(0.8, 0.85) | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" # game could be over at this point, check if game.alldone: return if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
course = (enemy.kloc - game.sector).course() | course = 1.90985*math.atan2(game.sector.y-enemy.kloc.y, enemy.kloc.x-game.sector.x) | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" # game could be over at this point, check if game.alldone: return if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
delt = 0.1*(w - game.sector) if delt.x==0 and delt.y==0: | deltx = 0.1*(w.y - game.sector.y) delty = 0.1*(w.x - game.sector.x) if deltx==0 and delty== 0: | def targetcheck(w): # Return None if target is invalid if not VALID_SECTOR(w.x, w.y): huh() return None delt = 0.1*(w - game.sector) if delt.x==0 and delt.y==0: skip(1) prout(_("Spock- \"Bridge to sickbay. Dr. McCoy,")) prout(_(" I recommend an immediate review of")) prout(_(" the Captain's psychological profile.\"... |
return delt.course() | return 1.90985932*math.atan2(deltx, delty) | def targetcheck(w): # Return None if target is invalid if not VALID_SECTOR(w.x, w.y): huh() return None delt = 0.1*(w - game.sector) if delt.x==0 and delt.y==0: skip(1) prout(_("Spock- \"Bridge to sickbay. Dr. McCoy,")) prout(_(" I recommend an immediate review of")) prout(_(" the Captain's psychological profile.\"... |
(aim-game.sector).distance()>2**0.5 and ienm in (IHC, IHS): | 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 for automode if damaged(DSRSENS) or damaged(DCOMPTR): itarg = False if game.condition == "docked": pro... |
if (ns-game - sector).distance() <= 2.1**0.5: | if (ns.x-game.sector.x)**2 + (ns.y-game.sector.y)**2 <= 2.1: | 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.x in range(GALSIZE): for nq.y in range(GALSIZE): stars += game.state.gal... |
if game.state.rembase: maxloop = game.state.rembase for loop in range(maxloop): if game.state.baseq[loop] == nq: game.state.baseq[loop] = game.state.baseq[game.state.rembase] game.state.baseq[game.state.rembase].invalidate() game.state.rembase -= 1 break | game.state.baseq = filter(lambda x: x != nq, game.state.baseq) game.state.rembase = len(game.state.baseq) | 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.x in range(GALSIZE): for nq.y in range(GALSIZE): stars += game.state.gal... |
game.dist = distance(game.sector, w) / (QUADSIZE * 1.0) | game.dist = (game.sector - w).distance() / (QUADSIZE * 1.0) | 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-game.enemy.kloc).distance() enemy.kavgd = 0.5 * (finald + ememy.kdist) enemy.kdist = finald game.enemies.sort(lambda x, y: cmp(x.k... |
game.dist = coord(deltax, deltay).distance() game.direc = coord(deltax, deltay).course() | game.dist = math.sqrt(deltax*deltax + deltay*deltay) game.direc = math.atan2(deltax, deltay)*1.90985932 | def getcourse(isprobe, akey): # get course and distance 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.")) scanner.chew() return... |
game.dist = ((w1 - game.quadrant) + 0.1 * (w2 - game.sector)).distance() | 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) | 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 s... |
for i in range(1, game.incom+1): | for i in range(game.incom): | 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 ... |
self.probex = 0.0 self.probey = 0.0 self.probeinx = 0.0 self.probeiny = 0.0 | self.probe = None self.probein = None | def __init__(self): self.options = None # Game options self.state = snapshot() # A snapshot structure self.snapsht = snapshot() # Last snapshot taken for time-travel purposes self.quad = None # contents of our quadrant self.damage = [0.0] * NDEVICES # damage encountered self.future = [] # future events for i in range(... |
import traceback | def recompute(self): # Stas thinks this should be (C expression): # game.state.remkl + len(game.state.kcmdr) > 0 ? | |
game.probex += game.probeinx game.probey += game.probeiny i = (int)(game.probex/QUADSIZE +0.05) j = (int)(game.probey/QUADSIZE + 0.05) | game.probe += game.probein i = int(round(game.probe.i/float(QUADSIZE))) j = int(round(game.probe.j/float(QUADSIZE))) | 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... |
if comunicating(): | if communicating(): | 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... |
if not VALID_QUADRANT(j, i): | if not VALID_QUADRANT(i, j): | 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... |
def getcourse(isprobe, akey): | def getcourse(isprobe): | 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 isprobe and akey != -1: key = akey akey = -1 else: key = scanner.next() | key = scanner.next() | 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 getcourse(isprobe=False, akey=0): | if not getcourse(isprobe=False): | def impulse(): "Move under impulse power." game.ididit = False if damaged(DIMPULS): scanner.chew() skip(1) prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")) return if game.energy > 30.0: if not getcourse(isprobe=False, akey=0): return power = 20.0 + 100.0*game.dist else: power = 30.0 if power >= gam... |
if not getcourse(isprobe=False, akey=0): | if not getcourse(isprobe=False): | def warp(timewarp): "ove under warp drive." blooey = False; twarp = False if not timewarp: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: scanner.chew() skip(1) prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: scanner.chew() ... |
prout(_("***Emergency automatic override attempts to hurl ")+crmshp()) skip(1) | proutn(_("***Emergency automatic override attempts to hurl ")+crmshp()) | def atover(igrab): "Cope with being tossed out of quadrant by supernova or yanked by beam." scanner.chew() # is captain on planet? if game.landed: if damaged(DTRANSP): finish(FPNOVA) return prout(_("Scotty rushes to the transporter controls.")) if game.shldup: prout(_("But with the shields up it's hopeless.")) finish(F... |
if not getcourse(isprobe=True, akey=key): | elif key == "IHREAL": scanner.push(scanner.token) if not getcourse(isprobe=True): | def probe(): "Launch deep-space probe." # New code to launch a deep space probe if game.nprobes == 0: scanner.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): scanner.chew() s... |
game.probeinx = -math.sin(angle) game.probeiny = math.cos(angle) if math.fabs(game.probeinx) > math.fabs(game.probeiny): bigger = math.fabs(game.probeinx) else: bigger = math.fabs(game.probeiny) game.probeiny /= bigger game.probeinx /= bigger | game.probein = coord(-math.sin(angle), math.cos(angle)) bigger = max(abs(game.probein.i), abs(game.probein.j)) game.probein /= bigger | def probe(): "Launch deep-space probe." # New code to launch a deep space probe if game.nprobes == 0: scanner.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): scanner.chew() s... |
game.probex = game.quadrant.i*QUADSIZE + game.sector.i - 1 game.probey = game.quadrant.j*QUADSIZE + game.sector.j - 1 game.probec = game.quadrant | game.probe = coord(game.quadrant.i*QUADSIZE + game.sector.i, game.quadrant.j*QUADSIZE + game.sector.j) game.probec = copy.copy(game.quadrant) | def probe(): "Launch deep-space probe." # New code to launch a deep space probe if game.nprobes == 0: scanner.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): scanner.chew() s... |
OPTION_RAMMING = 0x00000080 OPTION_MVBADDY = 0x00000100 OPTION_BLKHOLE = 0x00000200 OPTION_BASE = 0x00000400 OPTION_WORLDS = 0x00000800 | OPTION_RAMMING = 0x00000080 OPTION_MVBADDY = 0x00000100 OPTION_BLKHOLE = 0x00000200 OPTION_BASE = 0x00000400 OPTION_WORLDS = 0x00000800 OPTION_AUTOSCAN = 0x00001000 | def __init__(self): self.date = None # A real number self.quadrant = None # A coord structure |
self.kpower = fill2d(QUADSIZE, lambda i, j: 0.0) self.kdist = fill2d(QUADSIZE, lambda i, j: 0.0) self.kavgd = fill2d(QUADSIZE, lambda i, j: 0.0) | self.kpower = [0.0]*(QUADSIZE**2) self.kdist = [0.0]*(QUADSIZE**2) self.kavgd = [0.0]*(QUADSIZE**2) | def __init__(self): self.options = None # Game options self.state = snapshot() # A snapshot structure self.snapsht = snapshot() # Last snapshot taken for time-travel purposes self.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) # contents of our quadrant self.kpower = fill2d(QUADSIZE, lambda i, j: 0.0) # enemy energy level... |
self.ks = fill2d(QUADSIZE, lambda i, j: coord()) | self.ks = [] for i in range(QUADSIZE**2): self.ks.append(coord()) | def __init__(self): self.options = None # Game options self.state = snapshot() # A snapshot structure self.snapsht = snapshot() # Last snapshot taken for time-travel purposes self.quad = fill2d(QUADSIZE, lambda i, j: IHDOT) # contents of our quadrant self.kpower = fill2d(QUADSIZE, lambda i, j: 0.0) # enemy energy level... |
nenhr2 = game.nenhere; kk=1 | nenhr2 = game.nenhere; kk=0 | def hittem(hits): # register a phaser hit on Klingons and Romulans nenhr2 = game.nenhere; kk=1 w = coord() skip(1) for k in range(nenhr2): wham = hits[k] if wham==0: continue dustfac = randreal(0.9, 1.0) hit = wham*math.pow(dustfac,game.kdist[kk]) kpini = game.kpower[kk] kp = math.fabs(kpini) if PHASEFAC*hit < kp: kp =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.