def METHOD_NAME(self, mode, min_delta, percentage):
    if mode not in {"min", "max"}:
        raise ValueError("mode " + mode + " is unknown!")
    if not percentage:
        if mode == "min":
            self.is_better = lambda a, best: a < best - min_delta
        if mode == "max":
            self.is_better = lambda a, best: a > best + min_delta
    else:
        if mode == "min":
            self.is_better = lambda a, best: a < best - (best * min_delta / 100)
        if mode == "max":
            self.is_better = lambda a, best: a > best + (best * min_delta / 100)