def update(self):
self.frame += 1
+ actions = {}
for snake in self.snakes:
if not snake.alive: continue
if not snake.turbo and self.frame % 2 == 0: continue
snake.slither()
r, c = snake.segments[-1]
- action = self.tiles[r][c].action()
+ actions[snake] = self.tiles[r][c].action()
+ for snake in self.snakes:
+ if not snake.alive: continue
+ if not snake.turbo and self.frame % 2 == 0: continue
+ r, c = snake.segments[-1]
+ action = actions[snake]
if action.is_teleport():
self.tiles[r][c] = EmptyTile()
r, c = snake.segments[-1] = action.row, action.column