Просмотр исходного кода

shipbuilding: skip more mats, show final counts

raylu 1 неделя назад
Родитель
Сommit
0232d29757
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      shipbuilding.py

+ 6 - 4
shipbuilding.py

@@ -8,9 +8,11 @@ import roi
 
 BUY = frozenset([
 	# definitely buy
-	'C', 'FLX', 'H', 'H2O', 'HAL', 'HCP', 'HE', 'LST', 'MG', 'N', 'NA', 'NCS', 'NS', 'O', 'PE', 'PG', 'S', 'TCL',
+	'C', 'FLX', 'H', 'H2O', 'HAL', 'HCP', 'HE', 'LST', 'MG', 'N', 'NA', 'NCS', 'NS', 'O', 'PE', 'PG', 'S', 'TCL', 'THF',
 	# maybe buy
 	'AU', 'BRM', 'CU', 'FE', 'LI', 'RG', 'ROM', 'SI', 'TI',
+	# skip
+	'LFE', 'LHP', 'MFE', 'SFE', 'SSC',
 ])
 
 def main() -> None:
@@ -52,9 +54,9 @@ def main() -> None:
 			for mat, amount in production[building].items():
 				traded = prices[mat]['AverageTraded30D'] or 0
 				if traded > amount * 2:
-					print(f' \033[32m{mat}\033[0m', end='')
+					print(f' {amount:g}×\033[32m{mat}\033[0m', end='')
 				else:
-					print(f' \033[31m{mat}\033[0m', end='')
+					print(f' {amount:g}×\033[31m{mat}\033[0m', end='')
 			print()
 
 def recipe_for_mats() -> dict[str, roi.Recipe]:
@@ -95,7 +97,7 @@ def analyze_mat(level: int, mat: str, amount: float, production: dict[str, dict[
 			for input_mat in recipe['inputs']:
 				input_amount = input_mat['material_amount'] * amount / recipe['outputs'][0]['material_amount']
 				total_cost += analyze_mat(level + 1, input_mat['material_ticker'], input_amount, production, prices, recipes)
-			print('\t' * level + f'\tcost: {total_cost:9,.2f}')
+			print('\t' * level + f'\tcost: {total_cost:,.0f}')
 		return total_cost
 
 class RawPrice(typing.TypedDict):