Merge branch 'master' of github.com:billzorn/mtgencode

This commit is contained in:
Bill Zorn 2015-12-04 20:01:59 -08:00
commit 11eb30a5b5

View file

@ -46,6 +46,10 @@ def list_only(l, items):
return False return False
return True return True
def pct(x, total):
pctstr = 100.0 * float(x) / float(total)
return '(' + str(pctstr)[:5] + '%)'
def check_types(card): def check_types(card):
if 'instant' in card.types: if 'instant' in card.types:
return list_only(card.types, ['tribal', 'instant']) return list_only(card.types, ['tribal', 'instant'])
@ -378,20 +382,24 @@ def main(fname, oname = None, verbose = True, dump = False):
else: else:
total_bad += 1 total_bad += 1
if total_all == 0:
print('no cards seen?')
return
# summary # summary
print('-- overall --') print('-- overall --')
print(' total: ' + str(total_all)) print(' total: ' + str(total_all))
print(' good : ' + str(total_good)) print(' good : ' + str(total_good) + ' ' + pct(total_good, total_all))
print(' bad : ' + str(total_bad)) print(' bad : ' + str(total_bad) + ' ' + pct(total_bad, total_all))
print('----') print('----')
# breakdown # breakdown
for prop in props: for prop in props:
(total, good, bad) = values[prop] (total, good, bad) = values[prop]
print(prop + ':') print(prop + ':')
print(' total: ' + str(total)) print(' total: ' + str(total) + ' ' + pct(total, total_all))
print(' good : ' + str(good)) print(' good : ' + str(good) + ' ' + pct(good, total_all))
print(' bad : ' + str(bad)) print(' bad : ' + str(bad) + ' ' + pct(bad, total_all))
if __name__ == '__main__': if __name__ == '__main__':