|  | @@ -2,10 +2,11 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  from rival_regions_calc import Item, DeepExploration, ResourceCoefficient
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -TOTAL_COSTS = False
 | 
	
		
			
				|  |  | -GOLD_PRICE = 0.35
 | 
	
		
			
				|  |  | +TOTAL_COSTS = True 
 | 
	
		
			
				|  |  | +PRINT_AVERAGE = False 
 | 
	
		
			
				|  |  | +GOLD_PRICE = 0.15
 | 
	
		
			
				|  |  |  #DIAMOND_PRICE = 1600690
 | 
	
		
			
				|  |  | -DIAMOND_PRICE = 1664000
 | 
	
		
			
				|  |  | +DIAMOND_PRICE = 1720000
 | 
	
		
			
				|  |  |  REGIONS = {
 | 
	
		
			
				|  |  |      '4001': {
 | 
	
		
			
				|  |  |          'name': 'Northern Netherlands',
 | 
	
	
		
			
				|  | @@ -57,16 +58,29 @@ REGIONS = {
 | 
	
		
			
				|  |  |              'diamond': 13,
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    '4801': {
 | 
	
		
			
				|  |  | -        'name': 'Luxembourg',
 | 
	
		
			
				|  |  | -        'resources': {
 | 
	
		
			
				|  |  | -            'gold': 435,
 | 
	
		
			
				|  |  | -            'oil': 283,
 | 
	
		
			
				|  |  | -            'ore': 267,
 | 
	
		
			
				|  |  | -            'uranium': 2,
 | 
	
		
			
				|  |  | -            'diamond': 2,
 | 
	
		
			
				|  |  | -        },
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +TOTAL = {
 | 
	
		
			
				|  |  | +    'gold': {
 | 
	
		
			
				|  |  | +        'koef_increase': 0,
 | 
	
		
			
				|  |  | +        'total_cash': 0,
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    'oil': {
 | 
	
		
			
				|  |  | +        'koef_increase': 0,
 | 
	
		
			
				|  |  | +        'total_cash': 0,
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    'ore': {
 | 
	
		
			
				|  |  | +        'koef_increase': 0,
 | 
	
		
			
				|  |  | +        'total_cash': 0,
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    'uranium': {
 | 
	
		
			
				|  |  | +        'koef_increase': 0,
 | 
	
		
			
				|  |  | +        'total_cash': 0,
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    'diamond': {
 | 
	
		
			
				|  |  | +        'koef_increase': 0,
 | 
	
		
			
				|  |  | +        'total_cash': 0,
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  def calc_regions():
 | 
	
	
		
			
				|  | @@ -94,6 +108,9 @@ def calc_regions():
 | 
	
		
			
				|  |  |              koef_increase = 100 / old_koef * new_koef - 100
 | 
	
		
			
				|  |  |              print_prices(deep_exploration, old_koef, new_koef, koef_increase)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    if PRINT_AVERAGE:
 | 
	
		
			
				|  |  | +        print_average()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  def bucks(integer):
 | 
	
		
			
				|  |  |      """Format number"""
 | 
	
	
		
			
				|  | @@ -102,12 +119,14 @@ def bucks(integer):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  def print_prices(deep_exploration, old_koef, new_koef, koef_increase):
 | 
	
		
			
				|  |  |      """print costs"""
 | 
	
		
			
				|  |  | -    if TOTAL_COSTS:
 | 
	
		
			
				|  |  | +    total_cash = None
 | 
	
		
			
				|  |  | +    if TOTAL_COSTS or PRINT_AVERAGE:
 | 
	
		
			
				|  |  |          total_cash = round(
 | 
	
		
			
				|  |  |              deep_exploration.gold * GOLD_PRICE \
 | 
	
		
			
				|  |  |              + deep_exploration.diamond * DIAMOND_PRICE \
 | 
	
		
			
				|  |  |              + deep_exploration.cash
 | 
	
		
			
				|  |  |          )
 | 
	
		
			
				|  |  | +    if TOTAL_COSTS:
 | 
	
		
			
				|  |  |          print("%8s %16s %6.2f %6.2f %7.2f" % (
 | 
	
		
			
				|  |  |              deep_exploration.resource.name,
 | 
	
		
			
				|  |  |              bucks(total_cash),
 | 
	
	
		
			
				|  | @@ -115,6 +134,9 @@ def print_prices(deep_exploration, old_koef, new_koef, koef_increase):
 | 
	
		
			
				|  |  |              new_koef,
 | 
	
		
			
				|  |  |              koef_increase,
 | 
	
		
			
				|  |  |          ))
 | 
	
		
			
				|  |  | +    elif PRINT_AVERAGE:
 | 
	
		
			
				|  |  | +        TOTAL[deep_exploration.resource.name]['koef_increase'] += koef_increase
 | 
	
		
			
				|  |  | +        TOTAL[deep_exploration.resource.name]['total_cash'] += total_cash
 | 
	
		
			
				|  |  |      else:
 | 
	
		
			
				|  |  |          print("%-8s% 9s% 7.2f% 7.2f %7.2f" % (
 | 
	
		
			
				|  |  |              deep_exploration.resource.name,
 | 
	
	
		
			
				|  | @@ -124,6 +146,14 @@ def print_prices(deep_exploration, old_koef, new_koef, koef_increase):
 | 
	
		
			
				|  |  |              koef_increase,
 | 
	
		
			
				|  |  |          ))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +def print_average():
 | 
	
		
			
				|  |  | +    """Calculate and print average"""
 | 
	
		
			
				|  |  | +    for resource, values in TOTAL.items():
 | 
	
		
			
				|  |  | +        print(resource)
 | 
	
		
			
				|  |  | +        print("{:15,} - {:5}".format(
 | 
	
		
			
				|  |  | +            round(values['total_cash']/5),
 | 
	
		
			
				|  |  | +            round(values['koef_increase']/5),
 | 
	
		
			
				|  |  | +        ))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  if __name__ == "__main__":
 | 
	
		
			
				|  |  |      calc_regions()
 |