Ejemplo n.º 1
0
	def live_day(self):
		for comm in ["salt", "cybrous"]:
			for i in range(10):
				if self.i[comm] <= 2: break
				
				cog_min = min(Populous.Population, key=lambda c: c.i[comm])
				amount = 1
				price_per_unit = 5
				
				terms = (amount, comm, price_per_unit * amount, "dollars")
				self.trade(cog_min, terms)
	
		Cog.live_day(self)
Ejemplo n.º 2
0
	def live_day(self):
		if self.employer != None:
			relevant_i = self.employer.i
		else:
			relevant_i = self.i
			
			
		if relevant_i["salt"] < relevant_i["cybrous"]:
			comm = "salt"
		else:
			comm = "cybrous"
			
		v = self.mine(comm)
			
		if self.employer != None:
			print(v, comm)
			self.trade(self.employer, (v, comm, 3, "dollars"))
			
		Cog.live_day(self)
Ejemplo n.º 3
0
	def live_day(self):
		## buy from richest
		for comm in ["salt", "cybrous"]:
			cog_max = max(Populous.Population, key=lambda c: c.i[comm])
			amount = 6
			price_per_unit = 1
			
			terms = (price_per_unit * amount, "dollars", amount, comm)
			
			self.trade(cog_max, terms)
		
		## sell to poorest
		for comm in ["salt", "cybrous"]:
			cog_min = min(Populous.Population, key=lambda c: c.i[comm])
			amount = 2
			price_per_unit = 5
			
			terms = (amount, comm, price_per_unit * amount, "dollars")
			self.trade(cog_max, terms)
			
		Cog.live_day(self)