Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/snake/diff/0f7df983d610/main.py
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 06:59:30 2013
Кодировка:
snake: main.py diff

snake

diff main.py @ 168:0f7df983d610

fixed bag of unlimited run added screen
author Alex Martynov
date Thu, 23 Dec 2010 20:31:09 +0300
parents 36756bd7e7ed
children 4eec473f445b
line diff
     1.1 --- a/main.py	Thu Dec 23 20:24:56 2010 +0300
     1.2 +++ b/main.py	Thu Dec 23 20:31:09 2010 +0300
     1.3 @@ -60,7 +60,7 @@
     1.4          """Ask for snake file loading.
     1.5          Initialyzing snake and draw it on the field.
     1.6          Return field back to default (without snakes) after end of the game."""
     1.7 -        if self.step_id == 666:
     1.8 +        if self.step_id == self.game_length + 666:
     1.9              self.step_id = 0
    1.10              self.engine.snakes = [None, None, None, None]
    1.11              pass
    1.12 @@ -81,9 +81,6 @@
    1.13              self.restart(survived="yes")
    1.14          if self.dead_snake_check() == False:
    1.15              return
    1.16 -        if self.step_id > self.game_length:
    1.17 -            self.end()
    1.18 -            return
    1.19          self.engine.psnakes = self.engine.snakes[:]
    1.20          self.run()
    1.21          
    1.22 @@ -91,6 +88,9 @@
    1.23          """Run the game with 'step_length' ms step
    1.24          After the end of the game - restarts it with snakes survived in
    1.25          previous game"""
    1.26 +        if self.step_id > self.game_length:
    1.27 +            self.end()
    1.28 +            return
    1.29          self.step_id = self.step_id+1
    1.30          self.engine.step()
    1.31          self.after_id = self.canvas.after(self.step_length, self.run)