33
44import Glyphs
55from Quips import Quips
6+ from Quadrant import Quadrant
67
78class AbsShip (abc .ABC ):
89 ''' The first step, into a much larger universe ... '''
@@ -14,7 +15,7 @@ def __init__(self):
1415 def get_glyph (self ):
1516 pass
1617
17- class StarBase (AbsShip ):
18+ class ShipStarbase (AbsShip ):
1819
1920 def __init__ (self ):
2021 super ().__init__ ()
@@ -41,7 +42,7 @@ def launch_enterprise(ship):
4142 ship .docked = False
4243
4344
44- class Enterprise (AbsShip ):
45+ class ShipEnterprise (AbsShip ):
4546
4647 def __init__ (self ):
4748 super ().__init__ ()
@@ -56,14 +57,16 @@ def __init__(self):
5657 self .photon_damage = 0
5758 self .phaser_damage = 0
5859 self .photon_torpedoes = 0
59- StarBase .dock_enterprise (self )
60- StarBase .launch_enterprise (self )
60+ ShipStarbase .dock_enterprise (self )
61+ ShipStarbase .launch_enterprise (self )
6162
6263 def get_glyph (self ):
6364 return Glyphs .ENTERPRISE
6465
65-
6666 def damage (self , game , item ):
67+ '''
68+ Damage the Enterprise.
69+ '''
6770 if game .is_testing :
6871 return
6972 if random .randint (0 , 6 ) > 0 :
@@ -94,8 +97,10 @@ def damage(self, game, item):
9497 game .display (Quips .jibe_damage ('Phasers' ))
9598 game .display ()
9699
97-
98100 def repair (self , game ):
101+ '''
102+ Rapair damage to the Enterprise.
103+ '''
99104 if self .navigation_damage > 0 :
100105 self .navigation_damage -= 1
101106 if self .navigation_damage == 0 :
@@ -140,9 +145,7 @@ def repair(self, game):
140145 return True
141146 return False
142147
143-
144148 def short_range_scan (self , game ):
145-
146149 if self .short_range_scan_damage > 0 :
147150 game .display (Quips .jibe_damage ('Short Ranged Scanners' ))
148151 game .display ()
@@ -151,38 +154,43 @@ def short_range_scan(self, game):
151154 Quadrant .display_area (game , quad )
152155 game .display ()
153156
154-
155157 def long_range_scan (self , game ):
156158 if self .long_range_scan_damage > 0 :
157159 game .display (Quips .jibe_damage ('Long Ranged Scanners' ))
158160 game .display ()
159161 return
160162 sb = ""
161- game .display ("-------------------" )
162163 pw_sector = game .game_map .sector
163164 if pw_sector < 5 :
164165 pw_sector = 5
165166 elif pw_sector > 59 :
166167 pw_sector = 59
168+ dots = None
167169 for peek in range (pw_sector - 5 , pw_sector + 6 ):
168170 quad = game .game_map .scan_quad (peek )
169- f"{ quad .klingons } { quad .starbases } { quad .stars } "
170- sb += "|"
171+ lines = \
172+ (f"Sector: { quad .number :>02} " ,
173+ f"Enemies:{ quad .klingons :>02} " ,
174+ f"Bases:{ quad .starbases :>02} " ,
175+ f"Stars: { quad .stars :>03} " )
176+ str_ = ' | ' .join (lines )
177+ dots = '-' * len (str_ ) + "\n "
178+ sb += dots
179+ sb += str_
171180 game .display (sb )
172181 sb = ""
173- game .display ("-------------------" )
182+ game .display (dots )
174183 game .display ()
175184
176185
177- class KlingonShip (AbsShip ):
186+ class ShipKlingon (AbsShip ):
178187
179188 def __init__ (self ):
180189 super ().__init__ ()
181190 self .xpos = 0
182191 self .ypos = 0
183192 self .shield_level = 0
184193
185-
186194 def get_glyph (self ):
187195 return Glyphs .KLINGON
188196
0 commit comments