Rename some files

This commit is contained in:
Nate Bowman
2026-10-14 18:49:30 -04:00
parent 9fbfb96638
commit 10b02e3540
3 changed files with 216 additions and 291 deletions

29
decks/units-costs.py Normal file
View File

@@ -0,0 +1,29 @@
from flashcards.decks import create_deck_from_back_function
from flashcards.maps import create_maps, read_data_to_dict
# your choice of deck name and filename
deck_name = 'Unit Costs'
deck_fname = 'unit-costs'
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'units-basic.txt'
# key into json file specifying which data you want
# uncomment either 'units_buildings' or 'techs'
data_json_key = 'units_buildings'
#data_json_key = 'techs'
def card_back(num, name, data):
cost = data[num]['cost']
back = '\n'.join([f'{res}: {val}' for res, val in cost.items()
if val != 0])
return back
create_deck_from_back_function(namelist,
data_json_key,
card_back,
deck_name,
deck_fname)