Changeset 115:4cafedd51b69
Legend:
- Unmodified
- Added
- Removed
-
snake.py
r109 r115 ˆà 117 117 char = char.lower()ˆà 118 118 assert char in self.codes, "Illegal symbol in rule: %s" % charˆà 119 ˆà cell = engine.Cell(x, y, self.snake)ˆà ˆà 119 cell = engine.Cell(x, y)ˆà ˆà 120 cell.snake = self.snakeˆà 120 121 if char in 'htb':ˆà 121 122 if is_my:ˆà òÀæ òÀæ ˆà 132 133 def applies (self, field, x, y):ˆà 133 134 """True if the rule applies in the field at position (x,y)."""ˆà ˆà 135 wall = engine.Cell(-1, -1)ˆà ˆà 136 wall.type = 'void'ˆà ˆà 137 ˆà 134 138 for px, fx in zip(range(7), range(x - 3, x + 4)):ˆà 135 139 for py, fy in zip(range(7), range(y - 3, y + 4)):ˆà 136 ˆà if (fx, fy) in field:ˆà 137 ˆà if field[fx, fy] != self.pattern[px, py]:ˆà 138 ˆà return Falseˆà 139 ˆà else:ˆà 140 ˆà if self.pattern[px, py].type != 'any':ˆà 141 ˆà return Falseˆà ˆà 140 if field.get((fx, fy), wall) != self.pattern[px, py]:ˆà ˆà 141 return Falseˆà 142 142 return Trueˆà 143 143 ˆà
Note: See TracChangeset
for help on using the changeset viewer.