diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-03-25 15:21:11 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-03-25 15:21:11 (GMT) |
commit | 7fc52e02c2e79308ddfc949923049af4aca6f8d2 (patch) | |
tree | 893bdc47d7a28e6dfa9e427b08c944ed19cc6590 /game.py | |
parent | ccd6f8eb39c06603450c594a8de15a868710a822 (diff) |
added scoring
Diffstat (limited to 'game.py')
-rw-r--r-- | game.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -115,6 +115,8 @@ class Game(): self.placed_a_tile = False self._there_are_errors = False + self.score = 0 + def new_game(self, saved_state=None, deck_index=0): ''' Start a new game. ''' @@ -180,8 +182,9 @@ class Game(): ''' Set the label in the toolbar or the window frame. ''' if self._running_sugar: self._activity.status.set_label(string) + self._activity.score.set_label(_('Score: ') + str(self.score)) elif hasattr(self, 'win'): - self.win.set_title('%s: %s' % (_('Paths'), string)) + self.win.set_title('%s: %s [%d]' % (_('Paths'), string, self.score)) def its_my_turn(self): print 'its my turn' @@ -536,9 +539,9 @@ class Game(): if not self._test(i[0], i[1], None, self._test_a_connection): break_in_path[p] = True if not break_in_path[p] and len(self._paths[p]) > 0: - # TODO: Change the color of path 0 vs 1 for i in self._paths[p]: self.grid.grid[i[0]].set_shape(i[1]) + self.score += len(self._paths[p]) def _tile_to_test(self, test_path): ''' Find a tile that needs testing. ''' |