Changeset 104:c68b54a43501
- Timestamp:
- 12/20/10 11:22:26 (5 years ago)
- Branch:
- default
- Children:
- 106:bfd8f8d778a8, 109:7352863453bc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
snake.py
r88 r104 €а 123 123 return True€а 124 124 €а 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€а 128 130 self.rotate_ccw()€а €а 131 raise AssertionError("Illegal direction: %s" % direction)€а 129 132 €а 130 133 def rotate_ccw(self):€а
Note: See TracChangeset
for help on using the changeset viewer.