use of common.datastore.order.DepthOrder in project solution-finder by knewjade.
the class CheckerNoHold method check.
@Override
public boolean check(Field initField, Piece[] pieces, Candidate<T> candidate, int maxClearLine, int maxDepth) {
Field freeze = initField.freeze(maxClearLine);
int deleteLine = freeze.clearLine();
dataPool.initFirst();
dataPool.addOrder(new DepthOrder(freeze, null, maxClearLine - deleteLine, maxDepth));
while (!dataPool.getNexts().isEmpty() && dataPool.getResults().isEmpty()) {
Order order = dataPool.getNexts().pollLast();
int depth = order.getHistory().getNextIndex();
boolean isLast = depth == maxDepth;
assert depth < pieces.length : depth;
searcherCore.stepWithNextNoHold(candidate, pieces[depth], order, isLast);
}
return !dataPool.getResults().isEmpty();
}
use of common.datastore.order.DepthOrder in project solution-finder by knewjade.
the class CheckerUsingHold method check.
@Override
public boolean check(Field initField, Piece[] pieces, Candidate<T> candidate, int maxClearLine, int maxDepth) {
Field freeze = initField.freeze(maxClearLine);
int deleteLine = freeze.clearLine();
dataPool.initFirst();
dataPool.addOrder(new DepthOrder(freeze, pieces[0], maxClearLine - deleteLine, maxDepth));
while (!dataPool.getNexts().isEmpty() && dataPool.getResults().isEmpty()) {
Order order = dataPool.getNexts().pollLast();
OperationHistory history = order.getHistory();
assert history != null;
int depth = history.getNextIndex() + 1;
boolean isLast = depth == maxDepth;
if (depth < pieces.length) {
searcherCore.stepWithNext(candidate, pieces[depth], order, isLast);
} else {
searcherCore.stepWhenNoNext(candidate, order, isLast);
}
}
return !dataPool.getResults().isEmpty();
}
Aggregations