Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/snake/diff/73aed6bf1caf/engine.py
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 09:56:54 2013
Кодировка:
snake: engine.py diff

snake

diff engine.py @ 186:73aed6bf1caf

engine.legal_moves() now return list of legal moves added UI.snake_move_check() - "passed" changed name for UI.dead_snake_check() -> UI.snake_dead_check()
author Alex Martynov
date Tue, 28 Dec 2010 16:47:32 +0300
parents 0cf4e42c75a1
children
line diff
     1.1 --- a/engine.py	Tue Dec 28 16:36:23 2010 +0300
     1.2 +++ b/engine.py	Tue Dec 28 16:47:32 2010 +0300
     1.3 @@ -245,7 +245,9 @@
     1.4          return field_geometry, offset, c
     1.5      
     1.6      def legal_moves(self, snake):
     1.7 -        """Check for snake legal move directions according to the game rules."""
     1.8 +        """Check for snake legal move directions according to the game rules.
     1.9 +        Return:
    1.10 +        list of legal moves"""
    1.11          snake.legal_dir = []
    1.12          head = snake.cells[0]
    1.13          for direction in directions:
    1.14 @@ -253,5 +255,5 @@
    1.15              if (dir_cell.type == 'empty' or (dir_cell.type == 'tail' and dir_cell.snake != snake)):
    1.16                  snake.legal_dir.append(direction)
    1.17          rnd.shuffle(snake.legal_dir)
    1.18 -        return
    1.19 +        return snake.legal_dir
    1.20