Пример #1
0
 def find_mergeable_neighbours(self, piece):
     res = []
     for (nx, ny) in make_neighbours(piece.x, piece.y):
         neighbour = self.get_at(nx, ny)
         if neighbour and neighbour.owner is piece.owner:
             res.append(neighbour)
     return res
Пример #2
0
 def add_possible_move(self, x, y):
     pm = self.possible_moves
     pm.del_at(x, y)
     for (nx, ny) in make_neighbours(x, y):
     #for (nx, ny) in make_larger_neighbours(x, y):
         if self.get_at(nx, ny) is None:
             pm.put_at(nx, ny)