Mercurial > rinkhals
diff gamelib/gameboard.py @ 346:6baf8b5beb5c
Remove the "constant" constant
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 23:11:16 +0000 |
parents | 279974cc0698 |
children | e61f95503461 |
line wrap: on
line diff
--- a/gamelib/gameboard.py Sat Sep 05 23:08:34 2009 +0000 +++ b/gamelib/gameboard.py Sat Sep 05 23:11:16 2009 +0000 @@ -317,7 +317,7 @@ (animal.Rinkhals, 1), ) - def __init__(self, main_app): + def __init__(self, main_app, max_turns): self.disp = main_app self.tv = tiles.FarmVid() self.tv.png_folder_load_tiles('tiles') @@ -325,6 +325,7 @@ height, width = self.tv.size # Ensure we don't every try to create more foxes then is sane self.max_foxes = min(height+width-15, constants.ABS_MAX_NUM_FOXES) + self.max_turns = max_turns self.create_display() self.selected_tool = None @@ -826,9 +827,10 @@ def advance_day(self): self.days += 1 - if self.days == constants.TURN_LIMIT: + if self.days == self.max_turns: self.toolbar.day_counter.style.color = (255, 0, 0) - self.toolbar.update_day_counter("%s/%s" % (self.days, constants.TURN_LIMIT if constants.TURN_LIMIT > 0 else "-")) + self.toolbar.update_day_counter("%s/%s" % (self.days, + self.max_turns if self.max_turns > 0 else "-")) def clear_foxes(self): for fox in self.foxes.copy(): @@ -1060,7 +1062,7 @@ """Return true if we're complete""" if self.trees_left() == 0: return True - if constants.TURN_LIMIT > 0 and self.days >= constants.TURN_LIMIT: + if self.max_turns > 0 and self.days >= self.max_turns: return True if len(self.chickens) == 0: return True