minor cleanup

This commit is contained in:
Jack Boyce
2021-03-09 10:42:39 -08:00
parent fd76dee268
commit a5389e587c

View File

@@ -684,7 +684,7 @@ def computer():
def print_direction(from1, from2, to1, to2): def print_direction(from1, from2, to1, to2):
# Print a direction and distance between two locations in the grid. # Print direction and distance between two locations in the grid.
delta1 = -(to1 - from1) # flip so positive is up (heading = 3) delta1 = -(to1 - from1) # flip so positive is up (heading = 3)
delta2 = to2 - from2 delta2 = to2 - from2
@@ -873,7 +873,7 @@ def end_game(won=False, quit=True, enterprise_killed=False):
# Entry point and main game loop # Entry point and main game loop
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def main():
f = {'NAV': navigation, 'SRS': short_range_scan, 'LRS': long_range_scan, f = {'NAV': navigation, 'SRS': short_range_scan, 'LRS': long_range_scan,
'PHA': phaser_control, 'TOR': photon_torpedoes, 'SHE': shield_control, 'PHA': phaser_control, 'TOR': photon_torpedoes, 'SHE': shield_control,
'DAM': damage_control, 'COM': computer, 'XXX': end_game} 'DAM': damage_control, 'COM': computer, 'XXX': end_game}
@@ -885,10 +885,10 @@ while True:
while not restart: while not restart:
if s + e <= 10 or (e <= 10 and d[6] != 0): if s + e <= 10 or (e <= 10 and d[6] != 0):
print("\n** FATAL ERROR ** YOU'VE JUST STRANDED YOUR SHIP IN " print("\n** FATAL ERROR ** YOU'VE JUST STRANDED YOUR SHIP "
"SPACE.\nYOU HAVE INSUFFICIENT MANEUVERING ENERGY, AND " "IN SPACE.\nYOU HAVE INSUFFICIENT MANEUVERING ENERGY, "
"SHIELD CONTROL\nIS PRESENTLY INCAPABLE OF CROSS-CIRCUITING " "AND SHIELD CONTROL\nIS PRESENTLY INCAPABLE OF CROSS-"
"TO ENGINE ROOM!!") "CIRCUITING TO ENGINE ROOM!!")
command = input('COMMAND? ').upper().strip() command = input('COMMAND? ').upper().strip()
@@ -905,3 +905,7 @@ while True:
" DAM (FOR DAMAGE CONTROL REPORTS)\n" " DAM (FOR DAMAGE CONTROL REPORTS)\n"
" COM (TO CALL ON LIBRARY-COMPUTER)\n" " COM (TO CALL ON LIBRARY-COMPUTER)\n"
" XXX (TO RESIGN YOUR COMMAND)\n") " XXX (TO RESIGN YOUR COMMAND)\n")
if __name__ == "__main__":
main()