Skip to content

Commit

Permalink
Summary of themes
Browse files Browse the repository at this point in the history
  • Loading branch information
tukkek committed Aug 8, 2023
1 parent aa7539b commit 4299680
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions summary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import generate,goal,textwrap
import generate,goal,textwrap,theme

TIERS=textwrap.dedent('''
{} tiers generated for:
Expand All @@ -8,18 +8,21 @@
{} map reward categories, {} reward types:
{}
''')
THEMES='{} thematic sets of map modifiers ({}).'
SUMMARY=textwrap.dedent('''
{}
{}
{}
For a total of {} generated maps.
''')

def show(count):
categories=sorted(generate.categories,key=lambda x:len(x.maps),reverse=True)
tiers='\n'.join(f'- {len(c.maps)} {c.category}' for c in categories)
tiers=TIERS.format(len(generate.tiers),tiers)
tiers=TIERS.format(len(generate.tiers),tiers).strip()
goals=goal.categories
rewards=[]
for g in sorted(goals,key=lambda k:len(k),reverse=True):
Expand All @@ -31,7 +34,9 @@ def show(count):
entry=f'{ntypes} for {name} ({types})'
rewards.append(f'- {entry}')
ngoals=sum(len(g) for g in goals)
rewards=REWARDS.format(len(goals),ngoals,'\n'.join(rewards))
s=SUMMARY.format(tiers.strip(),rewards.strip(),f'{count:,}').strip()
rewards=REWARDS.format(len(goals),ngoals,'\n'.join(rewards)).strip()
themes=', '.join(sorted(t.name.lower() for t in theme.themes))
themes=THEMES.format(len(theme.themes),themes)
s=SUMMARY.format(tiers,rewards,themes,f'{count:,}').strip()
print(s)
print(s,file=open('summary.txt','w'))

0 comments on commit 4299680

Please sign in to comment.