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
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)