'A private helper function to take a group off the board (due to capture),
updating group sets and liberties along the way'

def _remove_group(self, group):

    for (x, y) in group:
        self._update_hash((x, y), self.board[(x, y)])
        self.board[(x, y)] = EMPTY
    for (x, y) in group:
        self.group_sets[x][y] = set()
        self.liberty_sets[x][y] = set()
        self.liberty_counts[x][y] = (-1)
        self.stone_ages[x][y] = (-1)
        for (nx, ny) in self._neighbors((x, y)):
            if (self.board[(nx, ny)] == EMPTY):
                self.liberty_sets[x][y].add((nx, ny))
            else:
                self.liberty_sets[nx][ny].add((x, y))
                for (gx, gy) in self.group_sets[nx][ny]:
                    self.liberty_counts[gx][gy] = len(self.liberty_sets[nx][ny])
