prompt window with logs on raised exception; minor UI updates; minor fixes

This commit is contained in:
Vasyl Horbachenko
2018-07-29 04:16:39 +03:00
parent 73d4a2d414
commit 9dbc9a8a56
25 changed files with 146 additions and 57 deletions

View File

@@ -1,3 +1,4 @@
import logging
import typing
import math
import itertools
@@ -53,7 +54,7 @@ class Base:
def _find_best_unit(self, dict, for_type: Task, count: int) -> typing.Dict:
if count <= 0:
print("{}: no units for {}".format(self, for_type))
logging.info("{}: no units for {}".format(self, for_type))
return {}
sorted_units = [key for key in dict.keys() if key in db.UNIT_BY_TASK[for_type]]
@@ -74,7 +75,7 @@ class Base:
assert result_unit_count > 0
result[unit_type] = result.get(unit_type, 0) + result_unit_count
print("{} for {} ({}): {}".format(self, for_type, count, result))
logging.info("{} for {} ({}): {}".format(self, for_type, count, result))
return result
def _find_best_planes(self, for_type: Task, count: int) -> typing.Dict[PlaneType, int]:

View File

@@ -35,5 +35,5 @@ def generate_initial(theater: ConflictTheater, enemy: str, sams: bool, multiplie
count = max(COUNT_BY_TASK[task] * multiplier * (1+count_log), 1)
count_per_type = max(int(float(count) / len(unittypes)), 1)
for unit_type in unittypes:
print("{} - {} {}".format(cp.name, db.unit_type_name(unit_type), count_per_type))
logging.info("{} - {} {}".format(cp.name, db.unit_type_name(unit_type), count_per_type))
cp.base.commision_units({unit_type: count_per_type})