comparison gamelib/gameboard.py @ 307:bf1df0902883

three game modes: fortnight, quarter, fox extinction
author Adrianna Pińska <adrianna.pinska@gmail.com>
date Sat, 05 Sep 2009 18:01:37 +0000
parents 32149b1d9fd2
children 49c58dda8ac2
comparison
equal deleted inserted replaced
306:c8267f62fbe8 307:bf1df0902883
1028 building = building_cls(tile_pos) 1028 building = building_cls(tile_pos)
1029 building.remove(self.tv) 1029 building.remove(self.tv)
1030 building.place(self.tv) 1030 building.place(self.tv)
1031 self.add_building(building) 1031 self.add_building(building)
1032 1032
1033 def trees_left(self):
1034 width, height = self.tv.size
1035 return len([(x,y) for x in range(width) for y in range(height) if self.tv.get((x,y)) == self.WOODLAND])
1036
1033 def is_game_over(self): 1037 def is_game_over(self):
1034 """Return true if we're complete""" 1038 """Return true if we're complete"""
1035 if self.days > constants.TURN_LIMIT: 1039 if self.trees_left() == 0:
1040 return True
1041 if constants.TURN_LIMIT > 0 and self.days > constants.TURN_LIMIT:
1036 return True 1042 return True
1037 if len(self.chickens) == 0: 1043 if len(self.chickens) == 0:
1038 return True 1044 return True