Changeset 116:10d32d7755ff
- Timestamp:
- 12/20/10 14:32:28 (5 years ago)
- Branch:
- default
- Parents:
- 114:793011c1119e (diff), 115:4cafedd51b69 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
snake.py
r112 r116 ˆà 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 ˆà -
snake.py
- Property exe set to *
r115 r116 ˆà 66 66 for cell in self.cells:ˆà 67 67 cell.snake = selfˆà ˆà 68 for cell in self.cells:ˆà ˆà 69 cell.type = 'body'ˆà 68 70 self.cells[0].type = 'head'ˆà 69 ˆà for cell in self.cells[1:-1]:ˆà70 ˆà cell.type = 'body'ˆà71 71 self.cells[-1].type = 'tail'ˆà 72 72 returnˆà
Note: See TracChangeset
for help on using the changeset viewer.