Search in sources :

Example 16 with ColumnSmallField

use of core.column_field.ColumnSmallField in project solution-finder by knewjade.

the class InOutPairFieldTest method createMaxOuterBoard2x5_2.

@Test
void createMaxOuterBoard2x5_2() {
    Field field = FieldFactory.createField("" + "___XX_XXXX" + "XXXXX_XXXX" + "_XXX_XXX_X" + "__XXXXXXXX" + "X_XXXXXXXX");
    int width = 2;
    int height = 5;
    SizedBit sizedBit = new SizedBit(width, height);
    ColumnSmallField maxOuterBoard = InOutPairField.createMaxOuterBoard(sizedBit, field);
    ColumnSmallField expects = ColumnFieldFactory.createField("" + "____X" + "__X_X" + "___X_" + "__XXX" + "__XXX", height);
    assertThat(maxOuterBoard).isEqualTo(expects);
}
Also used : Field(core.field.Field) ColumnSmallField(core.column_field.ColumnSmallField) ColumnSmallField(core.column_field.ColumnSmallField) Test(org.junit.jupiter.api.Test)

Example 17 with ColumnSmallField

use of core.column_field.ColumnSmallField in project solution-finder by knewjade.

the class InOutPairFieldTest method createInOutPairFields2x5.

@Test
void createInOutPairFields2x5() {
    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);
    // Create pairs
    List<InOutPairField> fields = InOutPairField.createInOutPairFields(sizedBit, field);
    assertThat(fields).hasSize(4);
    // Check inner
    ColumnSmallField innerField1 = ColumnFieldFactory.createField("" + "__" + "__" + "__" + "_X" + "X_", height);
    ColumnSmallField innerField2 = ColumnFieldFactory.createField("" + "__" + "_X" + "X_" + "__" + "__", height);
    ColumnSmallField innerField3 = ColumnFieldFactory.createField("" + "X_" + "__" + "__" + "_X" + "_X", height);
    ColumnSmallField innerField4 = ColumnFieldFactory.createField("" + "__" + "_X" + "XX" + "X_" + "__", height);
    assertThat(fields.stream().map(InOutPairField::getInnerField)).containsExactly(innerField1, innerField2, innerField3, innerField4);
    // Check outer
    ColumnSmallField outerField1 = ColumnFieldFactory.createField("" + "_____" + "___X_" + "__X__" + "_____" + "_____", height);
    ColumnSmallField outerField2 = ColumnFieldFactory.createField("" + "__X__" + "_____" + "_____" + "___X_" + "___X_", height);
    ColumnSmallField outerField3 = ColumnFieldFactory.createField("" + "_____" + "___X_" + "__XX_" + "__X__" + "_____", height);
    ColumnSmallField outerField4 = ColumnFieldFactory.createField("" + "__X_X" + "__X_X" + "___XX" + "___XX" + "___XX", height);
    assertThat(fields.stream().map(InOutPairField::getOuterField)).containsExactly(outerField1, outerField2, outerField3, outerField4);
}
Also used : Field(core.field.Field) ColumnSmallField(core.column_field.ColumnSmallField) ColumnSmallField(core.column_field.ColumnSmallField) Test(org.junit.jupiter.api.Test)

Example 18 with ColumnSmallField

use of core.column_field.ColumnSmallField in project solution-finder by knewjade.

the class PathEntryPoint method calculateBasicSolutions.

private BasicSolutions calculateBasicSolutions(Field field, MinoFactory minoFactory, MinoShifter minoShifter, SizedBit sizedBit, SolutionFilter solutionFilter) throws FinderInitializeException {
    // ミノのリストを作成する
    SeparableMinos separableMinos = SeparableMinos.createSeparableMinos(minoFactory, minoShifter, sizedBit);
    // 基本パターンを計算
    int cachedMinBit = settings.getCachedMinBit();
    Predicate<ColumnField> predicate = createPredicate(cachedMinBit);
    ColumnSmallField maxOuterBoard = InOutPairField.createMaxOuterBoard(sizedBit, field);
    return new FilterOnDemandBasicSolutions(separableMinos, sizedBit, maxOuterBoard, predicate, solutionFilter);
}
Also used : ColumnSmallField(core.column_field.ColumnSmallField) SeparableMinos(searcher.pack.SeparableMinos) ColumnField(core.column_field.ColumnField) EntryPoint(entry.EntryPoint) FilterOnDemandBasicSolutions(searcher.pack.solutions.FilterOnDemandBasicSolutions)

Aggregations

ColumnSmallField (core.column_field.ColumnSmallField)18 Field (core.field.Field)11 ColumnField (core.column_field.ColumnField)8 Test (org.junit.jupiter.api.Test)7 SmallField (core.field.SmallField)3 SizedBit (searcher.pack.SizedBit)2 MinoFieldMemento (searcher.pack.memento.MinoFieldMemento)2 ColumnFieldFactory (core.column_field.ColumnFieldFactory)1 Mino (core.mino.Mino)1 EntryPoint (entry.EntryPoint)1 ArrayList (java.util.ArrayList)1 Stream (java.util.stream.Stream)1 Randoms (lib.Randoms)1 SeparableMinos (searcher.pack.SeparableMinos)1 SolutionFilter (searcher.pack.memento.SolutionFilter)1 MemorizedRecursiveMinoFields (searcher.pack.mino_fields.MemorizedRecursiveMinoFields)1 MinoFields (searcher.pack.mino_fields.MinoFields)1 OnDemandRecursiveMinoFields (searcher.pack.mino_fields.OnDemandRecursiveMinoFields)1 RecursiveMinoFields (searcher.pack.mino_fields.RecursiveMinoFields)1 MinoMask (searcher.pack.separable_mino.mask.MinoMask)1