Example #1
0
 def neighbours(self, cell):
     Debug.log_with_action(cell.position_string(), 'Cell + neighbours')
     neighbours = []
     c = self.neighbour_left(cell)
     if c is not None:
       neighbours.append(c)
     c = self.neighbour_right(cell)
     if c is not None:
       neighbours.append(c)
     c = self.neighbour_up(cell)
     if c is not None:
       neighbours.append(c)
     c = self.neighbour_down(cell)
     if c is not None:
       neighbours.append(c)
     for i in neighbours:
       Debug.log(i.position_string())
     return neighbours
Example #2
0
 def buren(self, cel):
     Debug.log_with_action(cel.position_string(), 'Cel + buren')
     neighbours = []
     c = self.buur_links(cel)
     if c is not None:
         neighbours.append(c)
     c = self.buur_rechts(cel)
     if c is not None:
         neighbours.append(c)
     c = self.buur_boven(cel)
     if c is not None:
         neighbours.append(c)
     c = self.buur_onder(cel)
     if c is not None:
         neighbours.append(c)
     for i in neighbours:
         Debug.log(i.position_string())
     return neighbours
Example #3
0
 def potential_next_moves(self, snake):
     head = snake.snakeParts[0]
     Debug.log_with_action(head.position_string(), 'Head + potential moves')
     potential_cells = []
     c = self.neighbour_left(head)
     if c is not None:
         potential_cells.append(PotentialSnakePart(c.x, c.y))
     c = self.neighbour_right(head)
     if c is not None:
         potential_cells.append(PotentialSnakePart(c.x, c.y))
     c = self.neighbour_up(head)
     if c is not None:
         potential_cells.append(PotentialSnakePart(c.x, c.y))
     c = self.neighbour_down(head)
     if c is not None:
         potential_cells.append(PotentialSnakePart(c.x, c.y))
     for i in potential_cells:
       Debug.log(i.position_string())
     return potential_cells