sclass BestOfN implements Steppable { IF1 scoreFunction; IF0 produce; long nMax = 1000; double stopScore = infinity(); long attempt; new Best best; *(IF1 *scoreFunction, IF0 *produce, int *nMax) {} public bool step() { if (attempt+1 >= nMax || score >= stopScore) false; ++attempt; A a = produce!; double score = scoreFunction.get(a); best.put(a, score); true; } run { stepAll(this); } Scored get() { run(); ret best.scored(); } }