Rename some files
This commit is contained in:
29
decks/units-costs.py
Normal file
29
decks/units-costs.py
Normal 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)
|
||||
Reference in New Issue
Block a user