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.
This commit is contained in:
Nate Bowman
2026-10-14 19:17:16 -04:00
parent cd93d61129
commit c24f347af6
3 changed files with 221 additions and 0 deletions

26
example-fighting.py Normal file
View File

@@ -0,0 +1,26 @@
from flashcards.maps import (create_maps,
read_data_to_dict,
read_name_data_to_dict,
read_string_data_to_dict)
from flashcards.fighting import calculate_hits_to_kill
# 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
name_json_keys = 'units_buildings'
data_json_keys = ('data', 'Unit')
string_json_keys = ()
#name_data = read_name_data_to_dict(string_json_keys)
_, nums = create_maps(namelist, name_json_keys)
data = read_data_to_dict(data_json_keys)
hits = calculate_hits_to_kill('Hulk',
'Fire Ship',
data,
nums)
print(hits)