return `(self.crew, self.msgs)`
class StandingsTable:
- def __init__(self, use_puzzles=puzzles):
+ def __init__(self, use_puzzles=None, col_width=6):
+ if use_puzzles is None:
+ if opts.ship_duty:
+ use_puzzles=[
+ 'Navigating','Battle Navigation',
+ 'Gunning',
+ ['Sailing','Rigging'],
+ 'Bilging',
+ 'Carpentry',
+ 'Treasure Haul'
+ ]
+ else:
+ use_puzzles=puzzles
self._puzzles = use_puzzles
self.s = ''
+ self._cw = col_width-1
def _pline(self, pirate, puzstrs):
- self.s += '%-*s' % (max_pirate_namelen, pirate)
+ self.s += ' %-*s' % (max_pirate_namelen, pirate)
for v in puzstrs:
- self.s += ' %-*.*s' % (5,5, v)
+ self.s += ' %-*.*s' % (self._cw,self._cw, v)
self.s += '\n'
def _puzstr(self, pi, puzzle):
if not isinstance(puzzle,list): puzzle = [puzzle]
try: standing = max([pi.standings[p] for p in puzzle])
except KeyError: return '?'
- c1 = standingvals[standing][0]
- if standing < 3: c1 = c1.lower() # 3 = Master
- hashes = '*' * (standing / 2)
- equals = '+' * (standing % 2)
- return c1 + hashes + equals
+ if not standing: return ''
+ s = ''
+ if self._cw > 4:
+ c1 = standingvals[standing][0]
+ if standing < 3: c1 = c1.lower() # 3 = Master
+ s += `standing`
+ if self._cw > 5:
+ s += ' '
+ s += '*' * (standing / 2)
+ s += '+' * (standing % 2)
+ return s
def headings(self):
def puzn_redact(name):
if isinstance(name,list):
return '/'.join(
- ["%.2s" % puzn_redact(n)
+ ["%.*s" % (self._cw/2, puzn_redact(n))
for n in name])
spc = name.find(' ')
if spc < 0: return name
help='enable debugging output')
ao('-q','--quiet', action='store_true', dest='quiet',
help='suppress warning output')
+
+ ao('--ship-duty', action='store_true', dest='ship_duty',
+ help='show ship duty station puzzles')
+
(opts,args) = pa.parse_args()
if len(args) < 1: