Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.su/trac/snake/changeset/108
Дата изменения: Unknown
Дата индексирования: Sun Apr 10 01:41:33 2016
Кодировка: IBM-866
Changeset 108:d29a90f5095d тАУ Python Battle

Changeset 108:d29a90f5095d


Ignore:
Timestamp:
12/20/10 12:13:11 (5 years ago)
Author:
Alex Martynov <martiran@тАж>
Branch:
default
Children:
110:763c07539658, 111:9486211ec334
Message:

fixed snake dont move if can

File:
1 edited

Legend:

Unmodified
Added
Removed
  • engine.py

    r107 r108 €а
    148148    def legal_moves(self, snake):€а
    149149        snake.legal_dir = []€а
    €а150        head = snake.cells[0]€а
    150151        for direction in directions:€а
    151€а            dir_cell = self.field[snake.cells[0].y + direction[0], snake.cells[0].x + direction[1]]€а
    €а152            dir_cell = self.field[head.x + direction[0], head.y + direction[1]]€а
    152153            if (dir_cell.type == 'empty' or (dir_cell.type == 'tail' and dir_cell.snake != snake)):€а
    153154                snake.legal_dir.append(direction)€а
Note: See TracChangeset for help on using the changeset viewer.