comparison gamelib/gameboard.py @ 461:279caa00f3fa

exchange rate should be per tree, not per plank
author Adrianna Pińska <adrianna.pinska@gmail.com>
date Mon, 23 Nov 2009 21:01:15 +0000
parents 7204c16ab64d
children aba7f1439571
comparison
equal deleted inserted replaced
460:7204c16ab64d 461:279caa00f3fa
839 def trees_left(self): 839 def trees_left(self):
840 width, height = self.tv.size 840 width, height = self.tv.size
841 return len([(x,y) for x in range(width) for y in range(height) if self.tv.get((x,y)) == self.WOODLAND]) 841 return len([(x,y) for x in range(width) for y in range(height) if self.tv.get((x,y)) == self.WOODLAND])
842 842
843 def calculate_wood_groat_exchange_rate(self): 843 def calculate_wood_groat_exchange_rate(self):
844 # per five planks
844 width, height = self.tv.size 845 width, height = self.tv.size
845 sell_price = float(10*width*height)/self.trees_left() 846 sell_price = float(10*width*height)/self.trees_left()
846 buy_price = sell_price*(1.1) 847 buy_price = sell_price*(1.1)
847 self.wood_sell_price, self.wood_buy_price = int(sell_price), int(buy_price) 848 self.wood_sell_price, self.wood_buy_price = int(sell_price), int(buy_price)
848 849