Compare commits

...

21 Commits

Author SHA1 Message Date
Nate Bowman
a586357cc0 Add examples of deck scripts and namelists 2026-11-21 14:49:53 -05:00
Nate Bowman
6d05bfa7d5 Add non-AI MIT license 2026-11-21 13:54:28 -05:00
Nate Bowman
9132636d40 Add helper function 2026-11-20 19:59:59 -05:00
Nate Bowman
9c4b9bd020 Add another namelist because I need it elsewhere 2026-10-28 19:46:19 -04:00
Nate Bowman
80bb9790bf Remove fighting files from module
Moved them to their own module. Must now import that module to use any
of the fighting functions.
2026-10-27 19:51:53 -04:00
Nate Bowman
361a63b478 Add research deck 2026-10-27 19:23:22 -04:00
Nate Bowman
8cfd03c6ec Allow creation of fighting cards in bulk 2026-10-27 19:22:44 -04:00
Nate Bowman
d29868960e Add example/helper scripts 2026-10-27 19:19:52 -04:00
Nate Bowman
79e695a5b0 Remove duplicates from name_data file
Several names show up more than once under various IDs. I think this is
due to some of them existing in an old version of the game and being
scrapped and replaced with new ones. In any case, the duplicates threw
off some of the scripts.
2026-10-27 19:17:09 -04:00
Nate Bowman
b7c239b2fa Automate generation of fight results 2026-10-20 02:01:17 -04:00
Nate Bowman
ec3eb15731 Simplify running more than one fight at a time
This still requires too much manual work, so I probably will change
things up again, but I wanted to have a record just in case.
2026-10-18 17:44:17 -04:00
Nate Bowman
93372fed4a Simplify configuration 2026-10-16 16:33:49 -04:00
Nate Bowman
5146dc2893 Make running fights easier 2026-10-16 15:26:12 -04:00
Nate Bowman
045f8bc2c3 Modify how bonuses are managed 2026-10-16 11:17:01 -04:00
Nate Bowman
c24f347af6 Add function to simulate simple fighting
This is not yet complete.  I think I'm going to go a different way with
using bonus (research) information, but I wanted a copy of this in the
history just in case.
2026-10-14 19:17:16 -04:00
Nate Bowman
cd93d61129 Use relative path to config file
I don't feel like changing it every time I move the project.  Note that
this will not work unless settings.yaml exists in your working directory
when you run the Python command.
2026-10-14 19:09:29 -04:00
Nate Bowman
82ce8590b1 Add more data
Also renamed some of the files and had to change some code to account
for the new names.
2026-10-14 19:07:16 -04:00
Nate Bowman
10b02e3540 Rename some files 2026-10-14 18:49:30 -04:00
Nate Bowman
9fbfb96638 Rename example settings to avoid conflict with real ones 2026-10-11 20:33:25 -04:00
Nate Bowman
bba7bf58f1 Add another namelist needed for the examples 2026-10-04 19:04:23 -04:00
Nate Bowman
4c34263edc Add reference to data source 2026-10-04 19:03:14 -04:00
37 changed files with 38058 additions and 191 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
settings.yaml

31
LICENSE.txt Normal file
View File

@@ -0,0 +1,31 @@
MIT NON-AI License
Copyright (c) 2026, Nathaniel Bowman
Permission is hereby granted, free of charge, to any person obtaining a copy of the software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
In addition, the following restrictions apply:
1. The Software and any modifications made to it may not be used for the purpose of training or improving machine learning algorithms,
including but not limited to artificial intelligence, natural language processing, or data mining. This condition applies to any derivatives,
modifications, or updates based on the Software code. Any usage of the Software in an AI-training dataset is considered a breach of this License.
2. The Software may not be included in any dataset used for training or improving machine learning algorithms,
including but not limited to artificial intelligence, natural language processing, or data mining.
3. Any person or organization found to be in violation of these restrictions will be subject to legal action and may be held liable
for any damages resulting from such use.
4. This software repository contains open-source software licenses that can be modified and used to derive other software licenses.
However, no derivative, modification or update is allowed to remove the licensing conditions that forbid the use of that derivative
for the purpose of training, or improving machine learning algorithms, including but not limited to artificial intelligence,
natural language processing, or data mining.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -12,8 +12,7 @@ settings.yaml -- controls where files are read from and written to
``` ```
Once you have data in the correct format, creating the cards is trivial. The Once you have data in the correct format, creating the cards is trivial. The
data is provided by another project (I'll link it when I think about it; the data is provided by another project (referenced below) and pulled directly from AoE
name of the larger group is SiegeEngineers) and pulled directly from AoE
itself. However, the names and identifiers used in the data can be tricky. Most itself. However, the names and identifiers used in the data can be tricky. Most
of the work here is to create mappings between names and id numbers for that of the work here is to create mappings between names and id numbers for that
data. data.
@@ -47,3 +46,18 @@ Process:
you must run with `python -m decks.{file name without .py extension}` you must run with `python -m decks.{file name without .py extension}`
* The deck will be stored in output/decks-output/ * The deck will be stored in output/decks-output/
* Open Anki and import the deck * Open Anki and import the deck
# Acknowledgements
The data used for this project was downloaded from:
```
* https://github.com/SiegeEngineers/halfon/blob/master/data/units_buildings_techs.de.json
* https://github.com/SiegeEngineers/aoe2techtree/blob/master/data/data.json
* https://github.com/SiegeEngineers/aoe2techtree/blob/master/data/locales/en/strings.json
```
A few duplicate(-ish) elements were removed from `units_buildings_techs.de.json`.
The SiegeEngineers team on Github has a lot of cool stuff.
You should check them out.
The particular projects I took this from are called HALFON and aoe2techtree.

178
data/counters.json Normal file
View File

@@ -0,0 +1,178 @@
{
"Archer": {
"hard": [
"Militia",
"Spearman",
"Slinger",
"Camel Rider",
"Monk"
],
"soft": [
"Hand Cannoneer",
"Scout Cavalry",
"Steppe Lancer"
]
},
"Hand Cannoneer": {
"hard": [
"Militia",
"Spearman",
"Eagle",
"Slinger",
"Monk"
],
"soft": [
"Camel Rider",
"Steppe Lancer"
]
},
"Skirmisher": {
"hard": [
"Spearman",
"Archer",
"Slinger",
"Hand Cannoneer",
"Cavalry Archer",
"Elephant Archer",
"Monk"
],
"soft": []
},
"Knight": {
"hard": [
"Skirmisher",
"Slinger",
"Scout Cavalry"
],
"soft": [
"Militia",
"Eagle",
"Hand Cannoneer",
"Elephant Archer",
"Steppe Lancer"
]
},
"Cavalry Archer": {
"hard": [
"Militia",
"Slinger",
"Monk"
],
"soft": [
"Spearman",
"Archer",
"Hand Cannoneer",
"Knight",
"Steppe Lancer"
]
},
"Militia": {
"hard": [
"Spearman",
"Eagle"
],
"soft": [
"Skirmisher",
"Scout Cavalry",
"Camel Rider",
"Monk"
]
},
"Spearman": {
"hard": [
"Scout Cavalry",
"Knight",
"Camel Rider",
"Battle Elephant"
],
"soft": [
"Elephant Archer",
"Steppe Lancer"
]
},
"Monk": {
"hard": [
"Elephant Archer",
"Knight",
"Camel Rider",
"Battle Elephant"
],
"soft": [
"Steppe Lancer"
]
},
"Slinger": {
"hard": [
"Militia",
"Spearman",
"Eagle",
"Monk"
],
"soft": []
},
"Camel Rider": {
"hard": [
"Skirmisher",
"Elephant Archer",
"Scout Cavalry",
"Knight",
"Battle Elephant",
"Steppe Lancer"
],
"soft": [
"Slinger",
"Cavalry Archer"
]
},
"Scout Cavalry": {
"hard": [
"Skirmisher",
"Slinger",
"Monk"
],
"soft": []
},
"Battle Elephant": {
"hard": [
"Militia",
"Eagle",
"Scout Cavalry",
"Knight",
"Steppe Lancer"
],
"soft": []
},
"Steppe Lancer": {
"hard": [
"Skirmisher"
],
"soft": [
"Militia",
"Eagle",
"Slinger"
]
},
"Eagle": {
"hard": [
"Archer",
"Skirmisher",
"Monk"
],
"soft": [
"Spearman",
"Scout Cavalry",
"Camel Rider"
]
},
"Monk": {
"hard": [
"Elephant Archer",
"Knight",
"Camel Rider",
"Battle Elephant"
],
"soft": [
"Steppe Lancer"
]
}
}

34954
data/data.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -805,29 +805,6 @@
"localised_name": "", "localised_name": "",
"rms_const": null "rms_const": null
}, },
"35": {
"cost": {
"wood": 160,
"food": 0,
"gold": 75,
"stone": 0
},
"attack": 2,
"melee_armor": -3,
"pierce_armor": 180,
"base_id": 35,
"help_converter": 26094,
"language_file_name": 5094,
"language_file_help": 105094,
"name": "BTRAM",
"hit_points": 175,
"line_of_sight": 3,
"garrison_capacity": 6,
"type": 70,
"class": 13,
"localised_name": "Battering Ram",
"rms_const": "BATTERING_RAM"
},
"36": { "36": {
"cost": { "cost": {
"wood": 225, "wood": 225,
@@ -4232,29 +4209,6 @@
"localised_name": "", "localised_name": "",
"rms_const": null "rms_const": null
}, },
"184": {
"cost": {
"wood": 0,
"food": 50,
"gold": 35,
"stone": 0
},
"attack": 9,
"melee_armor": 1,
"pierce_armor": 3,
"base_id": 184,
"help_converter": 26114,
"language_file_name": 5114,
"language_file_help": 105114,
"name": "CONDOPLACEHOLDER",
"hit_points": 80,
"line_of_sight": 6,
"garrison_capacity": 0,
"type": 70,
"class": 6,
"localised_name": "Condottiero",
"rms_const": null
},
"185": { "185": {
"cost": { "cost": {
"wood": 25, "wood": 25,
@@ -13202,29 +13156,6 @@
"localised_name": "", "localised_name": "",
"rms_const": null "rms_const": null
}, },
"583": {
"cost": {
"wood": 50,
"food": 60,
"gold": 0,
"stone": 0
},
"attack": 4,
"melee_armor": 0,
"pierce_armor": 1,
"base_id": 583,
"help_converter": 26663,
"language_file_name": 5663,
"language_file_help": 105663,
"name": "GENIT",
"hit_points": 60,
"line_of_sight": 5,
"garrison_capacity": 0,
"type": 70,
"class": 36,
"localised_name": "Genitour",
"rms_const": "GENITOUR"
},
"584": { "584": {
"cost": { "cost": {
"wood": 100, "wood": 100,
@@ -13501,29 +13432,6 @@
"localised_name": "", "localised_name": "",
"rms_const": null "rms_const": null
}, },
"596": {
"cost": {
"wood": 50,
"food": 60,
"gold": 0,
"stone": 0
},
"attack": 5,
"melee_armor": 0,
"pierce_armor": 1,
"base_id": 596,
"help_converter": 26665,
"language_file_name": 5665,
"language_file_help": 105665,
"name": "GENITX",
"hit_points": 70,
"line_of_sight": 6,
"garrison_capacity": 0,
"type": 70,
"class": 36,
"localised_name": "Elite Genitour",
"rms_const": "ELITE_GENITOUR"
},
"597": { "597": {
"cost": { "cost": {
"wood": 275, "wood": 275,
@@ -20079,29 +19987,6 @@
"localised_name": "Wild Camel", "localised_name": "Wild Camel",
"rms_const": "DLC_WILD_CAMEL" "rms_const": "DLC_WILD_CAMEL"
}, },
"885": {
"cost": {
"wood": 220,
"food": 0,
"gold": 120,
"stone": 0
},
"attack": 6,
"melee_armor": -2,
"pierce_armor": 100,
"base_id": 885,
"help_converter": 26446,
"language_file_name": 5445,
"language_file_help": 105446,
"name": "SGTWR",
"hit_points": 220,
"line_of_sight": 8,
"garrison_capacity": 6,
"type": 70,
"class": 13,
"localised_name": "Siege Tower",
"rms_const": null
},
"886": { "886": {
"cost": { "cost": {
"wood": 0, "wood": 0,
@@ -21114,29 +20999,6 @@
"localised_name": "Khosrau", "localised_name": "Khosrau",
"rms_const": null "rms_const": null
}, },
"931": {
"cost": {
"wood": 0,
"food": 60,
"gold": 60,
"stone": 0
},
"attack": 18,
"melee_armor": 1,
"pierce_armor": 1,
"base_id": 931,
"help_converter": 26000,
"language_file_name": 5702,
"language_file_help": 105000,
"name": "JARL",
"hit_points": 140,
"line_of_sight": 7,
"garrison_capacity": 0,
"type": 70,
"class": 12,
"localised_name": "Jarl",
"rms_const": null
},
"932": { "932": {
"cost": { "cost": {
"wood": 0, "wood": 0,
@@ -21275,29 +21137,6 @@
"localised_name": "", "localised_name": "",
"rms_const": null "rms_const": null
}, },
"938": {
"cost": {
"wood": 180,
"food": 0,
"gold": 180,
"stone": 0
},
"attack": 4,
"melee_armor": 3,
"pierce_armor": 8,
"base_id": 938,
"help_converter": 26739,
"language_file_name": 5739,
"language_file_help": 105739,
"name": "DRAGS",
"hit_points": 150,
"line_of_sight": 6,
"garrison_capacity": 0,
"type": 70,
"class": 22,
"localised_name": "Dragon Ship",
"rms_const": null
},
"939": { "939": {
"cost": { "cost": {
"wood": 0, "wood": 0,
@@ -80399,4 +80238,4 @@
"localised_name": "" "localised_name": ""
} }
} }
} }

1105
data/strings.json Normal file

File diff suppressed because it is too large Load Diff

28
decks/building-costs.py Normal file
View File

@@ -0,0 +1,28 @@
from flashcards.decks import create_deck_from_back_function
# your choice of deck name and filename
deck_name = 'Building Costs'
deck_fname = 'building-costs'
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'buildings.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)

32
decks/building-times.py Normal file
View File

@@ -0,0 +1,32 @@
from flashcards.decks import create_deck
from flashcards.maps import (create_name_to_lname_map,
read_data_to_dict)
# your choice of deck name and filename
deck_name = 'Building Times'
deck_fname = 'building-times'
namelist = 'buildings.txt'
name_json_key = 'units_buildings'
data_json_keys = ('data', 'Building',)
lnames = create_name_to_lname_map(namelist, name_json_key)
data = read_data_to_dict(data_json_keys)
notes = []
for v in data.values():
name = v['internal_name']
if name in lnames.keys():
front = lnames[name]
back = str(v['TrainTime'])
notes.append((front, back))
#print(front, back)
else:
print(f'missing: {name} --')
print(v)
print('\n\n')
deck = create_deck(notes, deck_name, deck_fname)

54
decks/counters.py Normal file
View File

@@ -0,0 +1,54 @@
from collections import defaultdict
import json
from flashcards.config import config
from flashcards.decks import create_deck
from flashcards.maps import create_maps, read_name_data_to_dict
def generate_counter_list(counters):
all_c_names = []
for c_type in sorted(counters.keys()):
c_names = '\n'.join(counters[c_type])
if len(c_names) > 0:
all_c_names.append(f'<b>{c_type}</b>:\n\n{c_names}')
return '\n\n\n'.join(all_c_names)
# your choice of deck name and filename
deck_name = 'Counters'
deck_fname = 'counters'
# --- create list of notes ---
# read in data
with open(config.data_dir / 'counters.json', 'r') as f:
data = json.load(f)
# determine countered_by from counters
all_countered_by = defaultdict(lambda: defaultdict(list))
for unit, counters in data.items():
for counter_type in counters.keys(): # 'hard' or 'soft'
for unit2 in counters[counter_type]:
all_countered_by[unit2][counter_type].append(unit)
notes = []
for unit in data.keys():
# note: 'counters' contains units countered *by* 'unit'
# note: 'countered_by' contains units that counter 'unit'
counters = data[unit]
countered_by = all_countered_by[unit]
front = f'{unit} is a counter against...'
back = generate_counter_list(counters)
notes.append((front, back))
#print(f'front: {front}\tback: {back}')
front = f'{unit} is countered by...'
back = generate_counter_list(countered_by)
notes.append((front, back))
#print(f'front: {front}\tback: {back}')
# write deck to .apkg file
deck = create_deck(notes, deck_name, deck_fname)

View File

@@ -0,0 +1,44 @@
from flashcards.decks import create_deck
from fighting.fighting import Fighting
from flashcards.maps import (create_maps,
read_data_to_dict)
# your choice of deck name and filename
deck_name = 'Fighting (Units, Non-Unique)'
deck_fname = 'fighting-non-unique-units'
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'units-non-unique.txt'
# key into json file specifying which data you want
name_json_keys = 'units_buildings'
data_json_keys = ('data', 'Unit')
# --- create list of notes ---
_, nums = create_maps(namelist, name_json_keys)
data = read_data_to_dict(data_json_keys)
fight = Fighting(data, nums)
results = fight.generate_all_fight_results()
# create cards based on data and maps
notes = []
for k, v in results.items():
attacker, defender = k
title = f'{attacker} attacking {defender}'
for fight in v:
front = '\n'.join([title, fight['notes']])
hits = [f'{bonus}: {hit}' for bonus, hit in fight['hits'].items()]
back = '\n'.join(hits)
notes.append((front, back))
#print(f'front: {front}\tback: {back}')
# write deck to .apkg file
deck = create_deck(notes, deck_name, deck_fname)

View File

@@ -1,5 +1,5 @@
from flashcards.decks import create_deck from flashcards.decks import create_deck
from flashcards.maps import create_maps, read_data_to_dict from flashcards.maps import create_maps, read_name_data_to_dict
@@ -9,20 +9,20 @@ deck_fname = 'research-costs'
# specify the namelist to be used to create the deck # specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir # give the relative path of the file from config.namelists_dir
namelist = 'research.txt' namelist = 'research-standard.txt'
# key into json file specifying which data you want # key into json file specifying which data you want
# uncomment either 'units_buildings' or 'techs' # uncomment either 'units_buildings' or 'techs'
#data_json_key = 'units_buildings' #name_json_key = 'units_buildings'
data_json_key = 'techs' name_json_key = 'techs'
# --- create list of notes --- # --- create list of notes ---
# read in data # read in data
data = read_data_to_dict(data_json_key) data = read_name_data_to_dict(name_json_key)
# create maps between names and numbers based on namelist # create maps between names and numbers based on namelist
names, _ = create_maps(namelist, data_json_key) names, _ = create_maps(namelist, name_json_key)
# create cards based on data and maps # create cards based on data and maps
notes = [] notes = []

View File

@@ -0,0 +1,54 @@
from flashcards.decks import create_deck
from flashcards.helpers import parse_research_string
from flashcards.maps import (create_maps,
read_data_to_dict,
read_name_data_to_dict,
read_string_data_to_dict)
# your choice of deck name and filename
deck_name = 'Research (Non-Unique)'
deck_fname = 'research-non-unique'
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'research-non-unique.txt'
# key into json file specifying which data you want
name_json_keys = 'techs'
data_json_keys = ('data', 'Tech',)
string_json_keys = ()
# --- create list of notes ---
_, nums = create_maps(namelist, name_json_keys)
data = read_data_to_dict(data_json_keys)
names = read_name_data_to_dict(name_json_keys)
strings = read_string_data_to_dict(string_json_keys)
# create cards based on data and maps
order = ['Wood', 'Food', 'Gold', 'Stone']
notes = []
for name, num in nums.items():
front = name
cost = data[num]['Cost']
# works, but puts wood in the wrong order (i.e., after food)
#all_cost = '\n'.join([f'{res}: {val}' for res, val in cost.items()
#if val != 0])
all_cost = '\n'.join([f'{k}: {cost[k]}' for k in order
if k in cost.keys() and cost[k] != 0])
time_text = f'Research time: {data[num]["ResearchTime"]}'
help_id = str(names[num]['help_converter'])
help_text = parse_research_string(strings[help_id])
back = '\n\n'.join([all_cost, time_text, help_text])
notes.append((front, back))
#print(f'front: {name}\tback: {back}')
# write deck to .apkg file
deck = create_deck(notes, deck_name, deck_fname)

View File

@@ -1,5 +1,4 @@
from flashcards.decks import create_deck_from_back_function from flashcards.decks import create_deck_from_back_function
from flashcards.maps import create_maps, read_data_to_dict
@@ -9,7 +8,7 @@ deck_fname = 'unit-costs'
# specify the namelist to be used to create the deck # specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir # give the relative path of the file from config.namelists_dir
namelist = 'base-units.txt' namelist = 'units-basic.txt'
# key into json file specifying which data you want # key into json file specifying which data you want
# uncomment either 'units_buildings' or 'techs' # uncomment either 'units_buildings' or 'techs'

28
decks/units-times.py Normal file
View File

@@ -0,0 +1,28 @@
from flashcards.decks import create_deck
from flashcards.maps import (create_name_to_lname_map,
read_data_to_dict)
# your choice of deck name and filename
deck_name = 'Unit Training Times'
deck_fname = 'units-times'
namelist = 'units-non-unique.txt'
name_json_key = 'units_buildings'
data_json_keys = ('data', 'Unit',)
lnames = create_name_to_lname_map(namelist, name_json_key)
data = read_data_to_dict(data_json_keys)
notes = []
for v in data.values():
name = v['internal_name']
if name in lnames.keys():
front = lnames[name]
back = str(v['TrainTime'])
notes.append((front, back))
#print(front, back)
deck = create_deck(notes, deck_name, deck_fname)

40
decks/units-upgrades.py Normal file
View File

@@ -0,0 +1,40 @@
from flashcards.decks import create_deck
from flashcards.maps import (create_maps,
read_data_to_dict)
# your choice of deck name and filename
deck_name = 'Unit Upgrades'
deck_fname = 'unit-upgrades'
# key into json file specifying which data you want
data_json_keys = ('data', 'unit_upgrades',)
# --- create list of notes ---
data = read_data_to_dict(data_json_keys)
# create cards based on data and maps
order = ['Wood', 'Food', 'Gold', 'Stone']
notes = []
completed = set()
for d in data.values():
front = d['internal_name']
if front not in completed:
completed.add(front)
cost = d['Cost']
all_cost = '\n'.join([f'{k}: {cost[k]}' for k in order
if k in cost.keys() and cost[k] != 0])
time_text = f'Research time: {d["ResearchTime"]}'
back = '\n\n'.join([all_cost, time_text])
notes.append((front, back))
#print(f'front: {front}\tback: {back}')
# write deck to .apkg file
deck = create_deck(notes, deck_name, deck_fname)

View File

@@ -4,13 +4,17 @@ import yaml
config_file = '/home/nate/aoe/flashcards/settings.yaml' config_file = '/home/nate/projects/aoe/flashcards/settings.yaml'
with open(config_file, 'r') as f: with open(config_file, 'r') as f:
c = yaml.safe_load(f) c = yaml.safe_load(f)
root_path = Path(c['storage']['root']) data_path = Path(c['storage']['data'])
output_path = Path(c['storage']['output'])
config = SimpleNamespace() config = SimpleNamespace()
config.data_file = root_path / c['storage']['data'] / c['data_file'] config.data_dir = data_path
config.namelists_dir = root_path / c['storage']['namelists'] config.data_file = data_path / 'data.json'
config.decks_dir = root_path / c['storage']['decks'] config.name_data_file = data_path / 'name_data.json'
config.string_data_file = data_path / 'strings.json'
config.namelists_dir = output_path / 'namelists'
config.decks_dir = output_path / 'decks-output'

View File

@@ -1,4 +1,4 @@
from flashcards.maps import create_maps, read_data_to_dict from flashcards.maps import create_maps, read_name_data_to_dict
from flashcards.models import simple from flashcards.models import simple
from flashcards.random import random_anki_identifier from flashcards.random import random_anki_identifier
from flashcards.config import config from flashcards.config import config
@@ -52,7 +52,7 @@ def create_deck_from_functions(namelist,
deck_name, deck_name,
deck_fname): deck_fname):
# read in data # read in data
data = read_data_to_dict(data_json_key) data = read_name_data_to_dict(data_json_key)
# create maps between names and numbers based on namelist # create maps between names and numbers based on namelist
names, _ = create_maps(namelist, data_json_key) names, _ = create_maps(namelist, data_json_key)

3
flashcards/helpers.py Normal file
View File

@@ -0,0 +1,3 @@
def parse_research_string(string):
no_intro = string.split('\n')[1:]
return ' '.join(no_intro)

View File

@@ -21,7 +21,7 @@ def _fill_maps(big, key, whitelist):
def create_maps(namelist_fname, key): def create_maps(namelist_fname, key):
# Read in the full data dictionary # Read in the full data dictionary
with open(config.data_file, 'r') as f: with open(config.name_data_file, 'r') as f:
big = json.load(f) big = json.load(f)
# Use whitelist to filter data and map only as needed # Use whitelist to filter data and map only as needed
@@ -33,8 +33,48 @@ def create_maps(namelist_fname, key):
return names, nums return names, nums
def read_data_to_dict(key): def create_name_to_lname_map(namelist_fname, key):
with open(config.data_file, 'r') as f: # Read in the full data dictionary
with open(config.name_data_file, 'r') as f:
big = json.load(f)
# Use whitelist to filter data and map only as needed
namelist_path = config.namelists_dir / namelist_fname
with open(namelist_path, 'r') as f:
whitelist = [s.strip() for s in f.readlines()]
lnames = {}
for v in big[key].values():
lname = v['localised_name'].strip()
name = v['name'].strip()
if lname in whitelist:
if name in lnames.keys() and lnames[name] != lname:
raise Exception(f'Duplicate name {name} for {lname}')
lnames[name] = lname
return lnames
def read_string_data_to_dict(keys):
return _read_file_to_dict(config.string_data_file, keys)
def read_name_data_to_dict(keys):
return _read_file_to_dict(config.name_data_file, keys)
def read_data_to_dict(keys):
return _read_file_to_dict(config.data_file, keys)
def _read_file_to_dict(fname, keys):
if not type(keys) is tuple:
keys = (keys,)
with open(fname, 'r') as f:
all_data = json.load(f) all_data = json.load(f)
return all_data[key] for key in keys:
all_data = all_data[key]
return all_data

View File

@@ -1 +0,0 @@
*

View File

@@ -0,0 +1,41 @@
Archery Range
Barracks
Blacksmith
Dock
Siege Workshop
Farm
Fortified Gate
Mill
House
Town Center
Palisade Wall
Gate
Watch Tower
Castle
Market
Stable
Trade Workshop
Stone Wall
Fortified Wall
Fish Trap
University
Guard Tower
Keep
Bombard Tower
Wonder
Lumber Camp
Mining Camp
Outpost
Palisade Gate
Feitoria
Fortified Tower
Harbor
Krepost
Donjon
Folwark
Fortified Church
Settlement
Mule Cart
Caravanserai
Pasture
Monastery

View File

@@ -0,0 +1,41 @@
Archery Range
Barracks
Blacksmith
Dock
Siege Workshop
Farm
Fortified Gate
Mill
House
Town Center
Palisade Wall
Gate
Watch Tower
Castle
Market
Stable
Trade Workshop
Stone Wall
Fortified Wall
Fish Trap
University
Guard Tower
Keep
Bombard Tower
Wonder
Lumber Camp
Mining Camp
Outpost
Palisade Gate
Feitoria
Fortified Tower
Harbor
Krepost
Donjon
Folwark
Fortified Church
Settlement
Mule Cart
Caravanserai
Pasture
Monastery

View File

@@ -0,0 +1,71 @@
Elite Arambai
Elite Ballista Elephant
Elite Battle Elephant
Elite Berserk
Elite Blackwood Archer
Elite Bolas Rider
Elite Boyar
Elite Camel Archer
Elite Cannon Galleon
Elite Caravel
Elite Cataphract
Elite Centurion
Elite Chakram Thrower
Elite Champi Warrior
Elite Chu Ko Nu
Elite Composite Bowman
Elite Conquistador
Elite Coustillier
Elite Eagle Warrior
Elite Elephant Archer
Elite Fire Archer
Elite Fire Lancer
Elite Gbeto
Elite Genitour
Elite Genoese Crossbowman
Elite Ghulam
Elite Guecha Warrior
Elite Huskarl
Elite Hussite Wagon
Elite Ibirapema Warrior
Elite Iron Pagoda
Elite Jaguar Warrior
Elite Janissary
Elite Kamayuk
Elite Karambit Warrior
Elite Keshik
Elite Kipchak
Elite Kona
Elite Konnik
Elite Leitis
Elite Liao Dao
Elite Longboat
Elite Longbowman
Elite Magyar Huszar
Elite Mameluke
Elite Mangudai
Elite Monaspa
Elite Obuch
Elite Organ Gun
Elite Plumed Archer
Elite Qizilbash Warrior
Elite Ratha
Elite Rattan Archer
Elite Samurai
Elite Serjeant
Elite Shotel Warrior
Elite Shrivamsha Rider
Elite Skirmisher
Elite Steppe Lancer
Elite Tarkan
Elite Temple Guard
Elite Teutonic Knight
Elite Throwing Axeman
Elite Tiger Cavalry
Elite Turtle Ship
Elite Urumi Swordsman
Elite War Dog
Elite War Elephant
Elite War Wagon
Elite White Feather Guard
Elite Woad Raider

View File

@@ -0,0 +1,83 @@
Town Watch
Crop Rotation
Heavy Plow
Horse Collar
Guilds
Banking
Loom
Coinage
Medium Warships
Heavy Warships
Husbandry
Faith
Devotion
Chemistry
Caravan
Masonry
Architecture
Treadmill Crane
Gold Mining
Keep
Bombard Tower
Gillnets
Forging
Iron Casting
Scale Mail Armor
Blast Furnace
Chain Mail Armor
Plate Mail Armor
Plate Barding Armor
Scale Barding Armor
Chain Barding Armor
Ballistics
Feudal Age
Castle Age
Imperial Age
Guard Tower
Gold Shaft Mining
Fortified Wall
Fletching
Bodkin Arrow
Bracer
Double-Bit Axe
Bow Saw
Padded Archer Armor
Leather Archer Armor
Wheelbarrow
Squires
Ring Archer Armor
Two-Man Saw
Block Printing
Sanctity
Illumination
Hand Cart
Fervor
Stone Mining
Stone Shaft Mining
Town Patrol
Conscription
Redemption
Atonement
Sappers
Murder Holes
Shipwright
Careening
Dry Dock
Siege Engineers
Hoardings
Heated Shot
Spies/Treason
Bloodlines
Parthian Tactics
Thumb Ring
Theocracy
Heresy
Herbal Medicine
Arson
Arrowslits
Gambesons
Fishing Lines
Carvel Hull
Clinker Construction
Siphons
Incendiaries

View File

@@ -0,0 +1,232 @@
Anarchy
Andean Sling
Arbalester
Architecture
Arquebus
Arrowslits
Arson
Artillery
Atheism
Atlatl
Atonement
Aznauri Cavalry
Bagains
Ballistas
Ballistics
Banking
Bearded Axe
Bimaristan
Blast Furnace
Block Printing
Bloodlines
Bodkin Arrow
Bogsveigar
Bolt Magazine
Bombard Tower
Bow Saw
Bracer
Burgundian Vineyards
Butalmapu
Caciques
Capped Ram
Caravan
Careening
Carrack
Carvel Hull
Castle Age
Cavalier
Chain Barding Armor
Chain Mail Armor
Champion
Champi Runner
Champi Warrior
Chatras
Chemistry
Chieftains
Chivalry
Cilician Fleet
Circumnavigation
Citadels
Clinker Construction
Coiled Serpent Array
Coinage
Comitatenses
Conscription
Corvinian Army
Counterweights
Crenellations
Crop Rotation
Crossbowman
Cuman Mercenaries
Curare
Demolition Ship
Detinets
Devotion
Domestication
Double-Bit Axe
Double Crossbow
Drill
Druzhina
Dry Dock
Eagle Warrior
Eupseong
Fabric Shields
Faith
Farimba
Fereters
Fervor
Feudal Age
First Crusade
Fishing Lines
Flemish Revolution
Fletching
Forced Levy
Forging
Fortified Bastions
Fortified Wall
Frontier Guards
Furor Celtica
Gambesons
Garland Wars
Gillnets
Gold Mining
Gold Shaft Mining
Grand Trunk Road
Great Wall
Greek Fire
Guard Tower
Guilds
Halberdier
Hand Cart
Hauberk
Heated Shot
Heavy Camel Rider
Heavy Cavalry Archer
Heavy Demolition Ship
Heavy Hei Guang Cavalry
Heavy Plow
Heavy Rocket Cart
Heavy Scorpion
Heavy Warships
Herbalism
Herbal Medicine
Heresy
Hill Forts
Hoardings
Holcans
Horse Collar
Houfnice
Howdah
Huaracas
Hul'che Javelineers
Husbandry
Hussar
Hussite Reforms
Illumination
Imperial Age
Imperial Camel Rider
Imperial Skirmisher
Incendiaries
Inquisition
Iron Casting
Ironclad
Kamandaran
Kasbah
Kataparuto
Keep
Kshatriyas
Lamellar Armor
Leather Archer Armor
Lechitic Legacy
Legionary
Light Cavalry
Logistica
Long Swordsman
Loom
Madrasah
Maghrebi Camels
Mahayana
Malon
Man-at-Arms
Manipur Cavalry
Marauders
Masonry
Medical Corps
Medium Warships
Ming Guang Armor
Murder Holes
Nomads
Onager
Ordo Cavalry
Orthodoxy
Padded Archer Armor
Paiks
Paladin
Paper Money
Parthian Tactics
Pastoralism
Pavise
Perfusion
Pikeman
Pirotechnia
Plate Barding Armor
Plate Mail Armor
Recurve Bow
Red Cliffs Tactics
Redemption
Revetments
Ring Archer Armor
Rocketry
Royal Heirs
Sanctity
Sappers
Savar
Scale Barding Armor
Scale Mail Armor
Shatagni
Shinkichon
Shipwright
Siege Elephant
Siege Engineers
Siege Onager
Siege Ram
Silk Armor
Silk Road
Sipahi
Siphons
Sitting Tiger
Spies/Treason
Squires
Steppe Husbandry
Stirrups
Stone Mining
Stone Shaft Mining
Stronghold
Supplies
Supremacy
Svan Towers
Szlachta Privileges
Thalassocracy
Theocracy
Thumb Ring
Thunderclap Bombs
Tigui
Timurid Siegecraft
Torsion Engines
Tower Shields
Town Patrol
Town Watch
Transhumance
Treadmill Crane
Tuntian
Tusk Swords
Two-Handed Swordsman
Two-Man Saw
Wagenburg Tactics
Warwolf
Wheelbarrow
Winged Hussar
Wootz Steel
Yasama
Yeomen
Zealotry

View File

@@ -0,0 +1,108 @@
Yeomen
Holcans
Furor Celtica
Drill
Citadels
Artillery
Crenellations
Anarchy
Atheism
Garland Wars
Bimaristan
Bogsveigar
Rocketry
Kataparuto
Logistica
Supremacy
Shinkichon
Counterweights
Detinets
Perfusion
Atlatl
Warwolf
Great Wall
Chieftains
Greek Fire
Stronghold
Marauders
Yasama
Hul'che Javelineers
Eupseong
Nomads
Kamandaran
Ironclad
Sipahi
Inquisition
Chivalry
Silk Road
Grand Trunk Road
Shatagni
Druzhina
Corvinian Army
Recurve Bow
Andean Sling
Fabric Shields
Arquebus
Royal Heirs
Torsion Engines
Tigui
Farimba
Kasbah
Maghrebi Camels
Tusk Swords
Double Crossbow
Thalassocracy
Forced Levy
Howdah
Manipur Cavalry
Chatras
Paper Money
Stirrups
Bagains
Silk Armor
Timurid Siegecraft
Steppe Husbandry
Cuman Mercenaries
Hill Forts
Tower Shields
Burgundian Vineyards
Flemish Revolution
First Crusade
Hauberk
Szlachta Privileges
Lechitic Legacy
Wagenburg Tactics
Hussite Reforms
Medical Corps
Wootz Steel
Paiks
Mahayana
Kshatriyas
Frontier Guards
Ballistas
Comitatenses
Pirotechnia
Fereters
Cilician Fleet
Svan Towers
Aznauri Cavalry
Fortified Bastions
Thunderclap Bombs
Lamellar Armor
Ordo Cavalry
Transhumance
Pastoralism
Domestication
Tuntian
Ming Guang Armor
Bolt Magazine
Coiled Serpent Array
Red Cliffs Tactics
Sitting Tiger
Herbalism
Huaracas
Malon
Butalmapu
Caciques
Curare
Circumnavigation

View File

@@ -0,0 +1,225 @@
Archer
Hand Cannoneer
Elite Skirmisher
Skirmisher
Longbowman
Mangudai
Fishing Ship
Trade Cog
War Galley
Crossbowman
Teutonic Knight
Battering Ram
Bombard Cannon
Knight
Cavalry Archer
Cataphract
Huskarl
Trebuchet
Janissary
Chu Ko Nu
Militia
Man-at-Arms
Long Swordsman
Spearman
Monk
Condottiero
Slinger
Imperial Camel Rider
Woad Raider
War Elephant
Longboat
Scorpion
Mangonel
Throwing Axeman
Mameluke
Cavalier
Samurai
Camel Rider
Heavy Camel Rider
Trebuchet (Packed)
Pikeman
Halberdier
Cannon Galleon
Capped Ram
Petard
Hussar
Galleon
Scout Cavalry
Two-Handed Swordsman
Heavy Cavalry Archer
Arbalester
Demolition Ship
Heavy Demolition Ship
Fire Ship
Elite Longbowman
Elite Throwing Axeman
Fast Fire Ship
Elite Longboat
Elite Woad Raider
Galley
Heavy Scorpion
Transport Ship
Light Cavalry
Siege Ram
Onager
Elite Cataphract
Elite Teutonic Knight
Elite Huskarl
Elite Mameluke
Elite Janissary
Elite War Elephant
Elite Chu Ko Nu
Elite Samurai
Elite Mangudai
Champion
Paladin
Genitour
Siege Onager
Elite Genitour
Elite Cannon Galleon
Berserk
Elite Berserk
Jaguar Warrior
Elite Jaguar Warrior
Eagle Scout
Elite Eagle Warrior
Eagle Warrior
Tarkan
Elite Tarkan
Plumed Archer
Elite Plumed Archer
Conquistador
Elite Conquistador
Missionary
War Wagon
Elite War Wagon
Turtle Ship
Elite Turtle Ship
Genoese Crossbowman
Elite Genoese Crossbowman
Magyar Huszar
Elite Magyar Huszar
Elephant Archer
Elite Elephant Archer
Boyar
Elite Boyar
Kamayuk
Elite Kamayuk
Siege Tower
Dragon Ship
Organ Gun
Elite Organ Gun
Caravel
Elite Caravel
Camel Archer
Elite Camel Archer
Gbeto
Elite Gbeto
Shotel Warrior
Elite Shotel Warrior
Fire Galley
Demolition Raft
Ballista Elephant
Elite Ballista Elephant
Karambit Warrior
Elite Karambit Warrior
Arambai
Elite Arambai
Rattan Archer
Elite Rattan Archer
Battle Elephant
Elite Battle Elephant
Imperial Skirmisher
Konnik
Elite Konnik
Keshik
Elite Keshik
Kipchak
Elite Kipchak
Leitis
Elite Leitis
Flaming Camel
Steppe Lancer
Elite Steppe Lancer
Xolotl Warrior
Coustillier
Elite Coustillier
Serjeant
Elite Serjeant
Flemish Militia
Obuch
Elite Obuch
Hussite Wagon
Elite Hussite Wagon
Winged Hussar
Houfnice
Urumi Swordsman
Elite Urumi Swordsman
Ratha (Melee)
Elite Ratha (Melee)
Chakram Thrower
Elite Chakram Thrower
Armored Elephant
Siege Elephant
Ghulam
Elite Ghulam
Thirisadai
Shrivamsha Rider
Elite Shrivamsha Rider
Camel Scout
Ratha (Ranged)
Elite Ratha (Ranged)
Centurion
Elite Centurion
Legionary
Dromon
Composite Bowman
Elite Composite Bowman
Monaspa
Elite Monaspa
Warrior Priest
Savar
Fire Lancer
Elite Fire Lancer
Rocket Cart
Heavy Rocket Cart
Iron Pagoda
Elite Iron Pagoda
Grenadier
Liao Dao
Elite Liao Dao
Mounted Trebuchet
Traction Trebuchet
Hei Guang Cavalry
Heavy Hei Guang Cavalry
Lou Chuan
Tiger Cavalry
Elite Tiger Cavalry
Xianbei Raider
White Feather Guard
Elite White Feather Guard
Fire Archer
Elite Fire Archer
Jian Swordsman
Sun Jian
Champi Scout
Champi Warrior
Elite Champi Warrior
Guecha Warrior
Elite Guecha Warrior
Kona
Elite Kona
Bolas Rider
Elite Bolas Rider
Blackwood Archer
Elite Blackwood Archer
Ibirapema Warrior
Elite Ibirapema Warrior
Temple Guard
Elite Temple Guard
Champi Runner
Hulk
War Hulk
Carrack
Catapult Galleon

View File

@@ -0,0 +1,226 @@
Archer
Hand Cannoneer
Elite Skirmisher
Skirmisher
Longbowman
Mangudai
Fishing Ship
Trade Cog
War Galley
Crossbowman
Teutonic Knight
Battering Ram
Bombard Cannon
Knight
Cavalry Archer
Cataphract
Huskarl
Trebuchet
Janissary
Chu Ko Nu
Militia
Man-at-Arms
Long Swordsman
Spearman
Monk
Condottiero
Slinger
Imperial Camel Rider
Woad Raider
War Elephant
Longboat
Scorpion
Mangonel
Throwing Axeman
Mameluke
Cavalier
Samurai
Camel Rider
Heavy Camel Rider
Trebuchet (Packed)
Pikeman
Halberdier
Cannon Galleon
Capped Ram
Petard
Hussar
Galleon
Scout Cavalry
Two-Handed Swordsman
Heavy Cavalry Archer
Arbalester
Demolition Ship
Heavy Demolition Ship
Fire Ship
Elite Longbowman
Elite Throwing Axeman
Fast Fire Ship
Elite Longboat
Elite Woad Raider
Galley
Heavy Scorpion
Transport Ship
Light Cavalry
Siege Ram
Onager
Elite Cataphract
Elite Teutonic Knight
Elite Huskarl
Elite Mameluke
Elite Janissary
Elite War Elephant
Elite Chu Ko Nu
Elite Samurai
Elite Mangudai
Champion
Paladin
Genitour
Siege Onager
Elite Genitour
Elite Cannon Galleon
Berserk
Elite Berserk
Jaguar Warrior
Elite Jaguar Warrior
Eagle Scout
Elite Eagle Warrior
Eagle Warrior
Tarkan
Elite Tarkan
Plumed Archer
Elite Plumed Archer
Conquistador
Elite Conquistador
Missionary
War Wagon
Elite War Wagon
Turtle Ship
Elite Turtle Ship
Genoese Crossbowman
Elite Genoese Crossbowman
Magyar Huszar
Elite Magyar Huszar
Elephant Archer
Elite Elephant Archer
Boyar
Elite Boyar
Kamayuk
Elite Kamayuk
Siege Tower
Jarl
Dragon Ship
Organ Gun
Elite Organ Gun
Caravel
Elite Caravel
Camel Archer
Elite Camel Archer
Gbeto
Elite Gbeto
Shotel Warrior
Elite Shotel Warrior
Fire Galley
Demolition Raft
Ballista Elephant
Elite Ballista Elephant
Karambit Warrior
Elite Karambit Warrior
Arambai
Elite Arambai
Rattan Archer
Elite Rattan Archer
Battle Elephant
Elite Battle Elephant
Imperial Skirmisher
Konnik
Elite Konnik
Keshik
Elite Keshik
Kipchak
Elite Kipchak
Leitis
Elite Leitis
Flaming Camel
Steppe Lancer
Elite Steppe Lancer
Xolotl Warrior
Coustillier
Elite Coustillier
Serjeant
Elite Serjeant
Flemish Militia
Obuch
Elite Obuch
Hussite Wagon
Elite Hussite Wagon
Winged Hussar
Houfnice
Urumi Swordsman
Elite Urumi Swordsman
Ratha (Melee)
Elite Ratha (Melee)
Chakram Thrower
Elite Chakram Thrower
Armored Elephant
Siege Elephant
Ghulam
Elite Ghulam
Thirisadai
Shrivamsha Rider
Elite Shrivamsha Rider
Camel Scout
Ratha (Ranged)
Elite Ratha (Ranged)
Centurion
Elite Centurion
Legionary
Dromon
Composite Bowman
Elite Composite Bowman
Monaspa
Elite Monaspa
Warrior Priest
Savar
Fire Lancer
Elite Fire Lancer
Rocket Cart
Heavy Rocket Cart
Iron Pagoda
Elite Iron Pagoda
Grenadier
Liao Dao
Elite Liao Dao
Mounted Trebuchet
Traction Trebuchet
Hei Guang Cavalry
Heavy Hei Guang Cavalry
Lou Chuan
Tiger Cavalry
Elite Tiger Cavalry
Xianbei Raider
White Feather Guard
Elite White Feather Guard
Fire Archer
Elite Fire Archer
Jian Swordsman
Sun Jian
Champi Scout
Champi Warrior
Elite Champi Warrior
Guecha Warrior
Elite Guecha Warrior
Kona
Elite Kona
Bolas Rider
Elite Bolas Rider
Blackwood Archer
Elite Blackwood Archer
Ibirapema Warrior
Elite Ibirapema Warrior
Temple Guard
Elite Temple Guard
Champi Runner
Hulk
War Hulk
Carrack
Catapult Galleon

View File

@@ -0,0 +1,128 @@
Archer
Hand Cannoneer
Skirmisher
Longbowman
Mangudai
Fishing Ship
Junk
Trade Cog
War Galley
Teutonic Knight
Monastery
Fortress
Battering Ram
Bombard Cannon
Knight
Cavalry Archer
Cataphract
Huskarl
Trebuchet
Janissary
Chu Ko Nu
Militia
Spearman
Monk
Condottiero
Slinger
Woad Raider
War Elephant
Longboat
Scorpion
Mangonel
Throwing Axeman
Mameluke
Samurai
Camel Rider
Cannon Galleon
Petard
Hussar
Galleon
Scout Cavalry
Fire Ship
Galley
Transport Ship
Genitour
Berserk
Jaguar Warrior
Eagle Scout
Eagle Warrior
Tarkan
Plumed Archer
Conquistador
Missionary
War Wagon
Turtle Ship
Genoese Crossbowman
Magyar Huszar
Elephant Archer
Boyar
Kamayuk
Jarl
Dragon Ship
Organ Gun
Caravel
Camel Archer
Gbeto
Shotel Warrior
Demolition Raft
Ballista Elephant
Karambit Warrior
Arambai
Rattan Archer
Battle Elephant
Konnik
Keshik
Kipchak
Leitis
Flaming Camel
Steppe Lancer
Xolotl Warrior
Coustillier
Serjeant
Flemish Militia
Obuch
Hussite Wagon
Houfnice
Urumi Swordsman
Ratha (Melee)
Chakram Thrower
Armored Elephant
Ghulam
Thirisadai
Shrivamsha Rider
Caravanserai
Camel Scout
Centurion
Legionary
Dromon
Composite Bowman
Monaspa
Warrior Priest
Savar
Fire Lancer
Rocket Cart
Iron Pagoda
Grenadier
Liao Dao
Mounted Trebuchet
Traction Trebuchet
Hei Guang Cavalry
Lou Chuan
Tiger Cavalry
Xianbei Raider
Cao Cao
White Feather Guard
Liu Bei
Fire Archer
Jian Swordsman
Sun Jian
Champi Scout
Guecha Warrior
Kona
Bolas Rider
Blackwood Archer
Ibirapema Warrior
Temple Guard
Hulk
Carrack
Catapult Galleon

View File

@@ -0,0 +1,70 @@
Archer
Hand Cannoneer
Elite Skirmisher
Skirmisher
Fishing Ship
Trade Cog
War Galley
Crossbowman
Battering Ram
Bombard Cannon
Knight
Cavalry Archer
Trebuchet
Militia
Man-at-Arms
Long Swordsman
Spearman
Monk
Slinger
Scorpion
Mangonel
Cavalier
Camel Rider
Heavy Camel Rider
Trebuchet (Packed)
Pikeman
Halberdier
Capped Ram
Petard
Hussar
Galleon
Scout Cavalry
Two-Handed Swordsman
Heavy Cavalry Archer
Arbalester
Demolition Ship
Heavy Demolition Ship
Fire Ship
Fast Fire Ship
Galley
Heavy Scorpion
Transport Ship
Light Cavalry
Siege Ram
Onager
Champion
Paladin
Siege Onager
Eagle Scout
Siege Tower
Fire Galley
Demolition Raft
Xolotl Warrior
Winged Hussar
Armored Elephant
Siege Elephant
Camel Scout
Dromon
Rocket Cart
Heavy Rocket Cart
Traction Trebuchet
Hei Guang Cavalry
Heavy Hei Guang Cavalry
Lou Chuan
Champi Scout
Champi Runner
Hulk
War Hulk
Carrack
Catapult Galleon

View File

@@ -0,0 +1,3 @@
Spearman
Onager
Bombard Cannon

View File

@@ -0,0 +1,152 @@
Condottiero
Imperial Camel Rider
Missionary
Dragon Ship
Imperial Skirmisher
Houfnice
Thirisadai
Legionary
Warrior Priest
Savar
Grenadier
Mounted Trebuchet
Xianbei Raider
Jian Swordsman
Longbowman
Throwing Axeman
Longboat
Woad Raider
Cataphract
Teutonic Knight
Huskarl
Mameluke
Janissary
War Elephant
Chu Ko Nu
Samurai
Mangudai
Genitour
Cannon Galleon
Berserk
Jaguar Warrior
Eagle Warrior
Tarkan
Plumed Archer
Conquistador
War Wagon
Turtle Ship
Genoese Crossbowman
Magyar Huszar
Elephant Archer
Boyar
Kamayuk
Organ Gun
Caravel
Camel Archer
Gbeto
Shotel Warrior
Ballista Elephant
Karambit Warrior
Arambai
Rattan Archer
Battle Elephant
Konnik
Keshik
Kipchak
Leitis
Steppe Lancer
Coustillier
Serjeant
Obuch
Hussite Wagon
Urumi Swordsman
Ratha (Melee)
Chakram Thrower
Ghulam
Shrivamsha Rider
Ratha (Ranged)
Centurion
Composite Bowman
Monaspa
Fire Lancer
Iron Pagoda
Liao Dao
Tiger Cavalry
White Feather Guard
Fire Archer
Champi Warrior
Guecha Warrior
Kona
Bolas Rider
Blackwood Archer
Ibirapema Warrior
Temple Guard
Elite Longbowman
Elite Throwing Axeman
Elite Longboat
Elite Woad Raider
Elite Cataphract
Elite Teutonic Knight
Elite Huskarl
Elite Mameluke
Elite Janissary
Elite War Elephant
Elite Chu Ko Nu
Elite Samurai
Elite Mangudai
Elite Genitour
Elite Cannon Galleon
Elite Berserk
Elite Jaguar Warrior
Elite Eagle Warrior
Elite Tarkan
Elite Plumed Archer
Elite Conquistador
Elite War Wagon
Elite Turtle Ship
Elite Genoese Crossbowman
Elite Magyar Huszar
Elite Elephant Archer
Elite Boyar
Elite Kamayuk
Elite Organ Gun
Elite Caravel
Elite Camel Archer
Elite Gbeto
Elite Shotel Warrior
Elite Ballista Elephant
Elite Karambit Warrior
Elite Arambai
Elite Rattan Archer
Elite Battle Elephant
Elite Konnik
Elite Keshik
Elite Kipchak
Elite Leitis
Elite Steppe Lancer
Elite Coustillier
Elite Serjeant
Elite Obuch
Elite Hussite Wagon
Elite Urumi Swordsman
Elite Ratha (Melee)
Elite Chakram Thrower
Elite Ghulam
Elite Shrivamsha Rider
Elite Ratha (Ranged)
Elite Centurion
Elite Composite Bowman
Elite Monaspa
Elite Fire Lancer
Elite Iron Pagoda
Elite Liao Dao
Elite Tiger Cavalry
Elite White Feather Guard
Elite Fire Archer
Elite Champi Warrior
Elite Guecha Warrior
Elite Kona
Elite Bolas Rider
Elite Blackwood Archer
Elite Ibirapema Warrior
Elite Temple Guard

View File

@@ -0,0 +1,44 @@
import itertools
from flashcards.config import config
from flashcards.maps import (create_maps,
read_data_to_dict,
read_name_data_to_dict)
# --- General section to read in names and data
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'research-standard.txt'
# key into json file specifying which data you want
name_json_keys = 'techs'
data_json_keys = ('civs',)
_, nums = create_maps(namelist, name_json_keys)
data = read_data_to_dict(data_json_keys)
non_uniques = []
uniques = []
for name, num in nums.items():
count = 0
recent_civ = None
for civ in data.keys():
if int(num) in data[civ]['Tech']:
count += 1
recent_civ = civ
if count == 1:
#print(f'{name}: {recent_civ}')
uniques.append(name)
elif count > 1:
non_uniques.append(name)
with open(config.namelists_dir / 'research-unique.txt', 'w') as f:
f.writelines('\n'.join(uniques))
f.write('\n')
with open(config.namelists_dir / 'research-non-unique.txt', 'w') as f:
f.writelines('\n'.join(non_uniques))
f.write('\n')

View File

@@ -1,7 +0,0 @@
storage:
root: '/home/nate/aoe/flashcards/'
data: 'data'
namelists: 'output/namelists'
maps: 'output/maps'
decks: 'output/decks-output'
data_file: 'units_buildings_techs.de.json'

3
settings.yaml.example Normal file
View File

@@ -0,0 +1,3 @@
storage:
data: '/home/nate/projects/aoe/flashcards/data'
output: '/home/nate/projects/aoe/flashcards/output'