Search in sources :

Example 1 with DepthOrder

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();
}
Also used : Order(common.datastore.order.Order) DepthOrder(common.datastore.order.DepthOrder) Field(core.field.Field) DepthOrder(common.datastore.order.DepthOrder)

Example 2 with DepthOrder

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();
}
Also used : Order(common.datastore.order.Order) DepthOrder(common.datastore.order.DepthOrder) Field(core.field.Field) DepthOrder(common.datastore.order.DepthOrder) OperationHistory(common.OperationHistory)

Aggregations

DepthOrder (common.datastore.order.DepthOrder)2 Order (common.datastore.order.Order)2 Field (core.field.Field)2 OperationHistory (common.OperationHistory)1