Example #1
0
def main(cursor, options=None):
	w = world.World(cursor)
	
	city_f.apply_city_matrix(w)
	sad_f.supply_and_demand(w)
	
	return ""
Example #2
0
File: cli.py Project: Teifion/Rob3
def trade_real(options):
	from functions import city_f, trade_f, sad_f
	from classes import world
	from rules import sad_rules
	import sys
	
	w = world.World(database.get_cursor())
	city_f.apply_city_matrix(w)
	
	res = sad_f.supply_and_demand(w)
	
	# trade_f.print_reports(w, res, ['res_summary', 'res_surplus', 'res_demand', 'res_producers', 'production', 'demand', 'wealth'])
	# sad_f.print_reports(w, res, ['res_summary', 'demand', 'wealth'])
	
	total_sat = 0
	big_sat = 0
	big_count = 0
	wealth = 0
	for k, v in w.live_cities().items():
		total_sat += v.satisfaction()
		wealth += v.wealth
		
		if v.size > 15000:
			big_sat += v.satisfaction()
			big_count += 1
	
	print("Avg wealth: %s" % (wealth/len(w.live_cities())))
	print("Average: %s" % (total_sat/len(w.live_cities())))
	print("Big average: %s" % (big_sat/big_count))