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

Changeset 104:c68b54a43501


Ignore:
Timestamp:
12/20/10 11:22:26 (5 years ago)
Author:
Daniil Alexeyevsky <me.dendik@тАж>
Branch:
default
Children:
106:bfd8f8d778a8, 109:7352863453bc
Message:

Rule.rotate now accepts target direction, not number of times to rotate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • snake.py

    r88 r104 €а
    123123        return True€а
    124124€а
    125€а    def rotate (self, rot):€а
    126€а        """Rotate rule pattern `rot` times counterclockwise."""€а
    127€а        for i in range(((rot % 4) + 4) % 4):€а
    €а125    def rotate (self, direction):€а
    €а126        """Rotate rule pattern to head in `direction`."""€а
    €а127        for i in range(4):€а
    €а128            if self.direction == direction:€а
    €а129                return€а
    128130            self.rotate_ccw()€а
    €а131        raise AssertionError("Illegal direction: %s" % direction)€а
    129132€а
    130133    def rotate_ccw(self):€а
Note: See TracChangeset for help on using the changeset viewer.