use of core.column_field.ColumnSmallField in project solution-finder by knewjade.
the class FilterOnDemandBasicSolutions method addColumnSmallField.
private RecursiveMinoFields addColumnSmallField(ColumnField basicField) {
Field wallField = createWallField(basicField);
ColumnSmallField initOuterField = ColumnFieldFactory.createField();
RecursiveMinoFields recursiveMinoFields = calculate(basicField, initOuterField, wallField);
return new FilteredRecursiveMinoFields(recursiveMinoFields, solutionFilter);
}
use of core.column_field.ColumnSmallField in project solution-finder by knewjade.
the class MinoPackingTaskWidthForWidth2 method createTask.
private PackingTask createTask(PackSearcher searcher, long innerFieldBoard, MinoFieldMemento memento, int index) {
long fillBoard = searcher.getSizedBit().getFillBoard();
ColumnSmallField over = ColumnFieldFactory.createField(innerFieldBoard & ~fillBoard);
ColumnField outerField = searcher.getInOutPairFields().get(index).getOuterField();
if (over.canMerge(outerField)) {
over.merge(outerField);
ColumnSmallField innerField = ColumnFieldFactory.createField(innerFieldBoard & fillBoard);
return new MinoPackingTaskWidthForWidth2(searcher, innerField, over, memento, index);
}
return EMPTY_TASK;
}
use of core.column_field.ColumnSmallField in project solution-finder by knewjade.
the class MinoPackingTaskWidthForWidth3 method split.
private PackingTask split(MinoField minoField) {
ColumnField outerField = searcher.getInOutPairFields().get(index).getOuterField();
ColumnField minoOuterField = minoField.getOuterField();
// 注目範囲外outerで重なりがないか確認
if (outerField.canMerge(minoOuterField)) {
// 有効なおきかた
SizedBit sizedBit = searcher.getSizedBit();
ColumnField mergedOuterField = outerField.freeze(sizedBit.getHeight());
mergedOuterField.merge(minoOuterField);
ColumnSmallField nextInnerField = ColumnFieldFactory.createField(mergedOuterField.getBoard(0) >> sizedBit.getMaxBitDigit());
MinoFieldMemento nextMemento = memento.concat(minoField);
return checkAndCreateTask(nextInnerField, nextMemento, index + 1);
}
return EMPTY_TASK;
}
use of core.column_field.ColumnSmallField in project solution-finder by knewjade.
the class FullOperationSeparableMino method create.
public static SeparableMino create(FullOperationWithKey operationWithKey, int upperY, int fieldHeight) {
assert upperY <= 10 : upperY;
Mino mino = operationWithKey.getMino();
long deleteKey = operationWithKey.getNeedDeletedKey();
int y = operationWithKey.getY();
MinoMask minoMask = MinoMaskFactory.create(fieldHeight, mino, y, deleteKey);
int x = operationWithKey.getX();
Field mask = minoMask.getMinoMask(x);
int lowerY = operationWithKey.getY() + operationWithKey.getMino().getMinY();
ColumnSmallField columnField = ColumnFieldFactory.createField();
for (int ny = lowerY; ny <= upperY; ny++) {
for (int nx = x + mino.getMinX(); nx <= x + mino.getMaxX(); nx++) {
if (!mask.isEmpty(nx, ny))
columnField.setBlock(nx, ny, fieldHeight);
}
}
Field field = FieldFactory.createField(fieldHeight);
field.put(operationWithKey.getMino(), operationWithKey.getX(), operationWithKey.getY());
field.insertWhiteLineWithKey(operationWithKey.getNeedDeletedKey());
return new FullOperationSeparableMino(operationWithKey, columnField, field);
}
use of core.column_field.ColumnSmallField in project solution-finder by knewjade.
the class InOutPairFieldTest method createMaxOuterBoard2x5.
@Test
void createMaxOuterBoard2x5() {
Field field = FieldFactory.createField("" + "____X___X_" + "___X___XX_" + "__X___XX_X" + "_X___XX__X" + "X____X___X");
int width = 2;
int height = 5;
SizedBit sizedBit = new SizedBit(width, height);
ColumnSmallField maxOuterBoard = InOutPairField.createMaxOuterBoard(sizedBit, field);
ColumnSmallField expects = ColumnFieldFactory.createField("" + "_____" + "_____" + "_____" + "_____" + "_____", height);
assertThat(maxOuterBoard).isEqualTo(expects);
}
Aggregations