rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
profile = Profile.get_unique(user=self._user) | profile = Profile.get_unique(user=self.get_user()) | def get_profile(self, required=True): profile = Profile.get_unique(user=self._user) if not profile and required: message = "searched by user %s." % self._user.username raise EntityNotFoundError(Profile, message) return profile |
message = "searched by user %s." % self._user.username | message = "searched by user %s." % self.get_user().username | def get_profile(self, required=True): profile = Profile.get_unique(user=self._user) if not profile and required: message = "searched by user %s." % self._user.username raise EntityNotFoundError(Profile, message) return profile |
data["user"] = self._user | def update_data(self, data): data["profile"] = self.get_profile(required=False) data["user"] = self._user return super(BaseProfileAction, self).update_data(data) | |
if category not in categories: | if category not in self.categories: | def create_instance(self, csv_row): name = csv_row[0].strip() category = csv_row[7].strip() if category not in categories: return None address = csv_row[1].strip() route = csv_row[2].strip() city = csv_row[3].strip() if city == u"巴黎": city = u"Paris" tel_1 = csv_row[4].strip() or None resto = Resto.create( name=name, c... |
if scanner.token in commands or scanner.token == "ABBREV": | if scanner.token.upper() in commands or scanner.token == "ABBREV": | 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" s... |
try: fp = open(SSTDOC, "r") except IOError: | for directory in docpath: | 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" s... |
fp = open(DOC_NAME, "r") | fp = open(os.path.join(directory, "sst.doc"), "r") break | 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" s... |
prout(_("Spock- \"Captain, that information is missing from the")) proutn(_(" computer. You need to find ")) proutn(DOC_NAME) prout(_(" and put it in the")) proutn(_(" current directory or to ")) proutn(SSTDOC) prout(".\"") return | pass else: prout(_("Spock- \"Captain, that information is missing from the")) prout(_(" computer. You need to find sst.doc and put it somewhere")) proutn(_(" in these directories: %s") % ":".join(docpath)) prout(".\"") return | 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" s... |
if cmd == linebuf: | if cmd.upper() == linebuf: | 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" s... |
while linebuf in fp: | while True: linebuf = fp.readline() | 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" s... |
if sys.version_info.major < 3: | if sys.version_info[0] < 3: | def iostart(): global stdscr, rows "for some recent versions of python2, the following enables UTF8" "for the older ones we probably need to set C locale, and the python3" "has no problems at all" if sys.version_info.major < 3: import locale locale.setlocale(locale.LC_ALL, "") gettext.bindtextdomain("sst", "/usr/local/... |
l=1 while l <= len(game.enemies): | for l in range(len(game.enemies)): | def kaboom(): stars() if game.ship=='E': prouts("***") prouts(_("********* Entropy of %s maximized *********") % crmshp()) skip(1) stars() skip(1) if len(game.enemies) != 0: whammo = 25.0 * game.energy l=1 while l <= len(game.enemies): if game.enemies[l].power*game.enemies[l].kdist <= whammo: deadkl(game.enemies[l].loc... |
l += 1 | def kaboom(): stars() if game.ship=='E': prouts("***") prouts(_("********* Entropy of %s maximized *********") % crmshp()) skip(1) stars() skip(1) if len(game.enemies) != 0: whammo = 25.0 * game.energy l=1 while l <= len(game.enemies): if game.enemies[l].power*game.enemies[l].kdist <= whammo: deadkl(game.enemies[l].loc... | |
return iq.valid_Quadrant() and \ | return iq.valid_quadrant() and \ | def welcoming(iq): "Would this quadrant welcome another Klingon?" return iq.valid_Quadrant() and \ not game.state.galaxy[iq.i][iq.j].supernova and \ game.state.galaxy[iq.i][iq.j].klingons < MAXKLQUAD |
class TrekError: | class TrekError(Exception): pass class JumpOut(Exception): | def _(str): return gettext.gettext(str) |
self.galaxy = fill2d(GALSIZE, lambda i, j: quadrant()) | self.galaxy = fill2d(GALSIZE, lambda i_unused, j_unused: quadrant()) | def __init__(self): self.snap = False # snapshot taken self.crew = 0 # crew complement |
self.chart = fill2d(GALSIZE, lambda i, j: page()) | self.chart = fill2d(GALSIZE, lambda i_unused, j_unused: page()) | def __init__(self): self.snap = False # snapshot taken self.crew = 0 # crew complement |
for i in range(NEVENTS): | for i_unused in range(NEVENTS): | 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(... |
(_(" escapes to Quadrant %s (and regains strength).") % q)) | (_(" escapes to Quadrant %s (and regains strength).") % iq)) | def tryexit(enemy, look, irun): "A bad guy attempts to bug out." iq = coord() iq.i = game.quadrant.i+(look.i+(QUADSIZE-1))/QUADSIZE - 1 iq.j = game.quadrant.j+(look.j+(QUADSIZE-1))/QUADSIZE - 1 if not welcoming(iq): return False; if enemy.type == 'R': return False; # Romulans cannot escape! if not irun: # avoid intrudi... |
game.state.kcmdr[n] = iq | game.state.kcmdr.append(iq) | def tryexit(enemy, look, irun): "A bad guy attempts to bug out." iq = coord() iq.i = game.quadrant.i+(look.i+(QUADSIZE-1))/QUADSIZE - 1 iq.j = game.quadrant.j+(look.j+(QUADSIZE-1))/QUADSIZE - 1 if not welcoming(iq): return False; if enemy.type == 'R': return False; # Romulans cannot escape! if not irun: # avoid intrudi... |
next = coord(); look = coord() | goto = coord(); look = coord() | 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 idebug: | if game.idebug: | 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... |
next = enemy.location | goto = enemy.location | 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 = next + m | look = goto + m | 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 + krawli | look.i = goto.i + 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... |
look.j = next.j + krawlj | look.j = goto.j + 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... |
next = look if idebug: proutn(`next`) | goto = look if game.idebug: proutn(`goto`) | 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 enemy.move(next): | if enemy.move(goto): | 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... |
prout("Sector %s." % next) | prout("Sector %s." % goto) | 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 idebug: | if game.idebug: | def moveklings(): "Sequence Klingon tactical movement." if idebug: prout("== MOVCOM") # Figure out which Klingon is the commander (or Supercommander) # and do move if game.quadrant in game.state.kcmdr: for enemy in game.enemies: if enemy.type == 'C': movebaddy(enemy) if game.state.kscmdr==game.quadrant: for enemy in ga... |
if idebug: | if game.idebug: | 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... |
basetbl.sort(lambda x, y: cmp(x[1]. y[1])) | basetbl.sort(lambda x, y: cmp(x[1], y[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... |
if not idebug and \ | if not game.idebug and \ | 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... |
id = coord() | tid = coord() | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
id.i = 0; id.j = QUADSIZE-1 | tid.i = 0; tid.j = QUADSIZE-1 | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
id.i = QUADSIZE-1; id.j = QUADSIZE-1 | tid.i = QUADSIZE-1; tid.j = QUADSIZE-1 | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
id.i = QUADSIZE-1; id.j = 0 | tid.i = QUADSIZE-1; tid.j = 0 | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
id.i = 0; id.j = 0 | tid.i = 0; tid.j = 0 | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
if game.quad[id.i][id.j] not in ('.', ' | if game.quad[tid.i][tid.j] not in ('.', ' | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
delta = (id - game.tholian.location).sgn() | delta = (tid - game.tholian.location).sgn() | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
while here.i != id.i: | while here.i != tid.i: | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
while here.j != id.j: | while here.j != tid.j: | def movetholian(): "Move the Tholian." if not game.tholian or game.justin: return id = coord() if game.tholian.location.i == 0 and game.tholian.location.j == 0: id.i = 0; id.j = QUADSIZE-1 elif game.tholian.location.i == 0 and game.tholian.location.j == QUADSIZE-1: id.i = QUADSIZE-1; id.j = QUADSIZE-1 elif game.tholian... |
if ja() == True: | if ja(): | 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 s... |
sum = 0 | wsum = 0 | def randdevice(): "Choose a device to damage, at random." weights = ( 105, # DSRSENS: short range scanners 10.5% 105, # DLRSENS: long range scanners 10.5% 120, # DPHASER: phasers 12.0% 120, # DPHOTON: photon torpedoes 12.0% 25, # DLIFSUP: life support 2.5% 65, # DWARPEN: warp drive 6.5% 70, # DIMPULS: impulse... |
sum += w if idx < sum: | wsum += w if idx < wsum: | def randdevice(): "Choose a device to damage, at random." weights = ( 105, # DSRSENS: short range scanners 10.5% 105, # DLRSENS: long range scanners 10.5% 120, # DPHASER: phasers 12.0% 120, # DPHOTON: photon torpedoes 12.0% 25, # DLIFSUP: life support 2.5% 65, # DWARPEN: warp drive 6.5% 70, # DIMPULS: impulse... |
proutn("***" + crmship() + " heavily damaged.") | proutn("***" + crmshp() + " heavily damaged.") | def collision(rammed, enemy): "Collision handling fot rammong events." prouts(_("***RED ALERT! RED ALERT!")) skip(1) prout(_("***COLLISION IMMINENT.")) skip(2) proutn("***") proutn(crmshp()) hardness = {'R':1.5, 'C':2.0, 'S':2.5, 'T':0.5, '?':4.0}.get(enemy.type, 1.0) if rammed: proutn(_(" rammed by ")) else: proutn(_... |
prout(_("***Sickbay reports %d casualties"), icas) | prout(_("***Sickbay reports %d casualties") % icas) | def collision(rammed, enemy): "Collision handling fot rammong events." prouts(_("***RED ALERT! RED ALERT!")) skip(1) prout(_("***COLLISION IMMINENT.")) skip(2) proutn("***") proutn(crmshp()) hardness = {'R':1.5, 'C':2.0, 'S':2.5, 'T':0.5, '?':4.0}.get(enemy.type, 1.0) if rammed: proutn(_(" rammed by ")) else: proutn(_... |
for m in range(ncrits): | while ncrits > 0: ncrits -= 1 | def collision(rammed, enemy): "Collision handling fot rammong events." prouts(_("***RED ALERT! RED ALERT!")) skip(1) prout(_("***COLLISION IMMINENT.")) skip(2) proutn("***") proutn(crmshp()) hardness = {'R':1.5, 'C':2.0, 'S':2.5, 'T':0.5, '?':4.0}.get(enemy.type, 1.0) if rammed: proutn(_(" rammed by ")) else: proutn(_... |
shoved = True | def torpedo(origin, bearing, dispersion, number, nburst): "Let a photon torpedo fly" if not damaged(DSRSENS) or game.condition=="docked": setwnd(srscan_window) else: setwnd(message_window) ac = bearing + 0.25*dispersion # dispersion is a random variable bullseye = (15.0 - bearing)*0.5235988 track = course(bearing=ac, d... | |
for loop1 in range(ncrit): | while ncrit > 0: ncrit -= 1 | def fry(hit): "Critical-hit resolution." 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 prevent shuttle damage unless on... |
if idebug: | if game.idebug: | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack # game could be over at this point, check if game.alldone: return attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
course = 1.90985*math.atan2(game.sector.j-enemy.location.j, enemy.location.i-game.sector.i) | pcourse = 1.90985*math.atan2(game.sector.j-enemy.location.j, enemy.location.i-game.sector.i) | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack # game could be over at this point, check if game.alldone: return attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
hit = torpedo(enemy.location, course, dispersion, number=1, nburst=1) | hit = torpedo(enemy.location, pcourse, dispersion, number=1, nburst=1) | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack # game could be over at this point, check if game.alldone: return attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
propr *= 2.1 | propor *= 2.1 | def attack(torps_ok): # bad guy attacks us # torps_ok == False forces use of phasers in an attack # game could be over at this point, check if game.alldone: return attempt = False; ihurt = False; hitmax=0.0; hittot=0.0; chgfac=1.0 where = "neither" if idebug: prout("=== ATTACK!") # Tholian gets to move before attacking... |
course = [] | tcourse = [] | def torps(): "Launch photon torpedo salvo." 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() ret... |
course.append(course[0]) | tcourse.append(tcourse[0]) | def torps(): "Launch photon torpedo salvo." 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() ret... |
course.append(targetcheck(target[-1])) if course[-1] == None: | tcourse.append(targetcheck(target[-1])) if tcourse[-1] == None: | def torps(): "Launch photon torpedo salvo." 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() ret... |
torpedo(game.sector, course[i], dispersion, number=i, nburst=n) | torpedo(game.sector, tcourse[i], dispersion, number=i, nburst=n) | def torps(): "Launch photon torpedo salvo." 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() ret... |
nenhr2 = len(game.enemies); kk=0 | kk = 0 | def hittem(hits): "Register a phaser hit on Klingons and Romulans." nenhr2 = len(game.enemies); kk=0 w = coord() skip(1) for (k, wham) in enumerate(hits): if wham==0: continue dustfac = randreal(0.9, 1.0) hit = wham*math.pow(dustfac,game.enemies[kk].kdist) kpini = game.enemies[kk].power kp = math.fabs(kpini) if PHASEFA... |
if ja() == True: | if ja(): | def cancelrest(): "Rest period is interrupted by event." if game.resting: skip(1) proutn(_("Mr. Spock- \"Captain, shall we cancel the rest period?\"")) if ja() == True: game.resting = False game.optime = 0.0 return True return False |
if idebug: | if game.idebug: | 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] = '.' game.base.... |
raise "FOUNDIT" | raise JumpOut | 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] = '.' game.base.... |
except "FOUNDIT": | except JumpOut: | 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] = '.' game.base.... |
if ja() == False: | if not ja(): | 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? "... |
course = (0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5) | ncourse = (0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5) | 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(game.quadrant) return # handle initial nova game.quad[nov.i][nov.j] = '.' prout(crmena(False, '*', "sector", nov) +... |
direc = course[3*(bump.i+1)+bump.j+2] | direc = ncourse[3*(bump.i+1)+bump.j+2] | 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(game.quadrant) return # handle initial nova game.quad[nov.i][nov.j] = '.' prout(crmena(False, '*', "sector", nov) +... |
course = course(bearing=direc, distance=dist) | scourse = course(bearing=direc, distance=dist) | 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(game.quadrant) return # handle initial nova game.quad[nov.i][nov.j] = '.' prout(crmena(False, '*', "sector", nov) +... |
imove(course, noattack=True) game.optime = course.time(warp=4) | imove(scourse, noattack=True) game.optime = scourse.time(warp=4) | 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(game.quadrant) return # handle initial nova game.quad[nov.i][nov.j] = '.' prout(crmena(False, '*', "sector", nov) +... |
if idebug: | if game.idebug: | def supernova(w): "Star goes supernova." num = 0; npdead = 0 if w != None: nq = copy.copy(w) else: # Scheduled supernova -- select star at random. stars = 0 nq = coord() for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.galaxy[nq.i][nq.j].stars if stars == 0: return # nothing to supernova exis... |
if ja() == True: | if ja(): | def supernova(w): "Star goes supernova." num = 0; npdead = 0 if w != None: nq = copy.copy(w) else: # Scheduled supernova -- select star at random. stars = 0 nq = coord() for nq.i in range(GALSIZE): for nq.j in range(GALSIZE): stars += game.state.galaxy[nq.i][nq.j].stars if stars == 0: return # nothing to supernova exis... |
if game.thawed and not idebug: | if game.thawed and not game.idebug: | def finish(ifin): # end the game, with appropriate notfications igotit = False game.alldone = True skip(3) prout(_("It is stardate %.1f.") % game.state.date) skip(1) if ifin == FWON: # Game has been won if game.state.nromrem != 0: prout(_("The remaining %d Romulans surrender to Starfleet Command.") % game.state.nromrem... |
if ja() == True: | if ja(): | def finish(ifin): # end the game, with appropriate notfications igotit = False game.alldone = True skip(3) prout(_("It is stardate %.1f.") % game.state.date) skip(1) if ifin == FWON: # Game has been won if game.state.nromrem != 0: prout(_("The remaining %d Romulans surrender to Starfleet Command.") % game.state.nromrem... |
for j in range(rows): | for j_unused in range(rows): | 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.clear() prompt_window.addstr(prompt) prompt_window.getstr() prompt_window.clear() prompt_window.refresh() setwnd(message... |
if ja() == False: | if not ja(): | 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: try: course = getcourse(isprobe=False) except TrekError: return power = 20.0 + 100.0*course.distance else: power ... |
if not game.shldup or 0.5*power > game.energy: | if not game.shldup or 0.5*course.power(game.warpfac) > game.energy: | def warp(course, involuntary): "ove under warp drive." blooey = False; twarp = False if not involuntary: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: scanner.chew() skip(1) prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: scan... |
if ja() == False: | if not ja(): | def warp(course, involuntary): "ove under warp drive." blooey = False; twarp = False if not involuntary: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: scanner.chew() skip(1) prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: scan... |
if idebug and game.warpfac==10 and not twarp: | if game.idebug and game.warpfac==10 and not twarp: | def warp(course, involuntary): "ove under warp drive." blooey = False; twarp = False if not involuntary: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: scanner.chew() skip(1) prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: scan... |
if ja() == True: | if ja(): | def warp(course, involuntary): "ove under warp drive." blooey = False; twarp = False if not involuntary: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: scanner.chew() skip(1) prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: scan... |
for m in range(course.moves): | for m_unused in range(course.moves): | def warp(course, involuntary): "ove under warp drive." blooey = False; twarp = False if not involuntary: # Not WARPX entry game.ididit = False if game.damage[DWARPEN] > 10.0: scanner.chew() skip(1) prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\"")) return if damaged(DWARPEN) and game.warpfac > 4.0: scan... |
if ja() == False: | if not ja(): | 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 == 'E': 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... |
or idebug: | or game.idebug: | def survey(): "Report on (uninhabited) planets in the galaxy." iknow = False skip(1) scanner.chew() prout(_("Spock- \"Planet report follows, Captain.\"")) skip(1) for i in range(game.inplan): if game.state.planets[i].pclass == "destroyed": continue if (game.state.planets[i].known != "unknown" \ and not game.state.plan... |
if idebug and game.state.planets[i].known=="unknown": | if game.idebug and game.state.planets[i].known=="unknown": | def survey(): "Report on (uninhabited) planets in the galaxy." iknow = False skip(1) scanner.chew() prout(_("Spock- \"Planet report follows, Captain.\"")) skip(1) for i in range(game.inplan): if game.state.planets[i].pclass == "destroyed": continue if (game.state.planets[i].known != "unknown" \ and not game.state.plan... |
if game.state.planets[i].crystals != present: | if game.state.planets[i].crystals != "present": | def survey(): "Report on (uninhabited) planets in the galaxy." iknow = False skip(1) scanner.chew() prout(_("Spock- \"Planet report follows, Captain.\"")) skip(1) for i in range(game.inplan): if game.state.planets[i].pclass == "destroyed": continue if (game.state.planets[i].known != "unknown" \ and not game.state.plan... |
if ja() == True: | if ja(): | def beam(): "Use the transporter." nrgneed = 0 scanner.chew() skip(1) if damaged(DTRANSP): prout(_("Transporter damaged.")) if not damaged(DSHUTTL) and (game.iplnet.known=="shuttle_down" or game.iscraft == "onship"): skip(1) proutn(_("Spock- \"May I suggest the shuttle craft, Sir?\" ")) if ja() == True: shuttle() retu... |
if ja() == False: | if not ja(): | def beam(): "Use the transporter." nrgneed = 0 scanner.chew() skip(1) if damaged(DTRANSP): prout(_("Transporter damaged.")) if not damaged(DSHUTTL) and (game.iplnet.known=="shuttle_down" or game.iscraft == "onship"): skip(1) proutn(_("Spock- \"May I suggest the shuttle craft, Sir?\" ")) if ja() == True: shuttle() retu... |
if ja() == False: | if not ja(): | def usecrystals(): "Use dilithium crystals." game.ididit = False skip(1) scanner.chew() if not game.icrystl: prout(_("No dilithium crystals available.")) return if game.energy >= 1000: prout(_("Spock- \"Captain, Starfleet Regulations prohibit such an operation")) prout(_(" except when Condition Yellow exists.")) retu... |
if ja() == False: | if not ja(): | def shuttle(): "Use shuttlecraft for planetary jaunt." scanner.chew() skip(1) if damaged(DSHUTTL): if game.damage[DSHUTTL] == -1.0: if game.inorbit and game.iplnet.known == "shuttle_down": prout(_("Ye Faerie Queene has no shuttle craft bay to dock it at.")) else: prout(_("Ye Faerie Queene had no shuttle craft.")) elif ... |
if ja() == True: | if ja(): | def shuttle(): "Use shuttlecraft for planetary jaunt." scanner.chew() skip(1) if damaged(DSHUTTL): if game.damage[DSHUTTL] == -1.0: if game.inorbit and game.iplnet.known == "shuttle_down": prout(_("Ye Faerie Queene has no shuttle craft bay to dock it at.")) else: prout(_("Ye Faerie Queene had no shuttle craft.")) elif ... |
if ja() == False: | if not ja(): | def deathray(): "Use the big zapper." game.ididit = False skip(1) scanner.chew() if game.ship != 'E': prout(_("Ye Faerie Queene has no death ray.")) return if len(game.enemies)==0: prout(_("Sulu- \"But Sir, there are no enemies in this quadrant.\"")) return if damaged(DDRAY): prout(_("Death Ray is damaged.")) return p... |
intj | def deathray(): "Use the big zapper." game.ididit = False skip(1) scanner.chew() if game.ship != 'E': prout(_("Ye Faerie Queene has no death ray.")) return if len(game.enemies)==0: prout(_("Sulu- \"But Sir, there are no enemies in this quadrant.\"")) return if damaged(DDRAY): prout(_("Death Ray is damaged.")) return p... | |
if idebug: | if game.idebug: | 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 = game.shldchg = game.shldup = False game.ship = 'E' game.state.crew = FULLCREW game.energy = game.inenrg = 5000.0 game.shield = game.inshld ... |
idebug = True | game.idebug = True | def choose(): "Choose your game type." while True: game.tourn = game.length = 0 game.thawed = False game.skill = SKILL_NONE 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 scanner.next() ... |
for i in range(3): | for i_unused in range(3): | 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)) |
raise SysExit,1 | raise SystemExit,1 | def makemoves(): "Command-interpretation loop." clrscr() setwnd(message_window) while True: # command loop drawmaps(1) while True: # get a command hitme = False game.optime = game.justin = False scanner.chew() setwnd(prompt_window) clrscr() proutn("COMMAND> ") if scanner.next() == "IHEOL": if game.options & OPTION_CUR... |
if idebug: | if game.idebug: | def makemoves(): "Command-interpretation loop." clrscr() setwnd(message_window) while True: # command loop drawmaps(1) while True: # get a command hitme = False game.optime = game.justin = False scanner.chew() setwnd(prompt_window) clrscr() proutn("COMMAND> ") if scanner.next() == "IHEOL": if game.options & OPTION_CUR... |
def __repr__(str): | def __repr__(self): | def __repr__(str): return "<sstcanner: token=%s, type=%s, queue=%s>" % (scanner.token, scanner.type, scanner.inqueue) |
if ja() == True: | if ja(): | 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 ja() == True: idebug = not idebug if idebug: | if ja(): game.idebug = not game.idebug if game.idebug: | 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] > ... |
global line, thing, game, idebug | global line, thing, game | 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] > ... |
idebug = 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] > ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.