Search in sources :

Example 36 with MinoFactory

use of core.mino.MinoFactory in project solution-finder by knewjade.

the class TetfuTest method decode3.

@Test
void decode3() throws Exception {
    // empty
    String value = "vhAAgH";
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    List<TetfuPage> pages = tetfu.decode(value);
    assertThat(pages).hasSize(1);
    assertThat(pages.get(0)).returns(ColorType.Empty, TetfuPage::getColorType).returns(Rotate.Reverse, TetfuPage::getRotate).returns(0, TetfuPage::getX).returns(22, TetfuPage::getY).returns("", TetfuPage::getComment);
    assertField(ColoredFieldFactory.createColoredField(""), pages.get(0).getField());
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 37 with MinoFactory

use of core.mino.MinoFactory in project solution-finder by knewjade.

the class TetfuTest method encode3.

@Test
void encode3() throws Exception {
    List<TetfuElement> elements = Arrays.asList(new TetfuElement(ColorType.I, Rotate.Reverse, 5, 0, "a"), new TetfuElement(ColorType.S, Rotate.Reverse, 5, 2, "b"), new TetfuElement(ColorType.J, Rotate.Left, 9, 1, "c"), new TetfuElement(ColorType.O, Rotate.Right, 0, 1, "d"), new TetfuElement(ColorType.Z, Rotate.Left, 3, 1, "e"), new TetfuElement(ColorType.L, Rotate.Right, 0, 3, "日本語"), new TetfuElement(ColorType.T, Rotate.Reverse, 7, 1));
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("vhGBQYBABBAAAnmQBACBAAA+tQBADBAAALpQBAEBAA?AcqQBAFBAAAKfQSAlfrHBFwDfE2Cx2Bl/PwB53AAAlsQAA");
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 38 with MinoFactory

use of core.mino.MinoFactory in project solution-finder by knewjade.

the class TetfuTest method decode6.

@Test
void decode6() throws Exception {
    String value = "VhRpHeRpNeAgHvhIAAAAAAAAAAAAAAAAAAAAAAAAAA?A";
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    List<TetfuPage> pages = tetfu.decode(value);
    assertThat(pages).hasSize(10);
    for (int index = 0; index < 10; index++) {
        assertThat(pages.get(index)).returns(ColorType.Empty, TetfuPage::getColorType).returns("", TetfuPage::getComment);
    }
    assertField(ColoredFieldFactory.createColoredField("" + "____OO____" + "____OO____"), pages.get(9).getField());
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 39 with MinoFactory

use of core.mino.MinoFactory in project solution-finder by knewjade.

the class TetfuTest method decode1.

@Test
void decode1() throws Exception {
    String value = "bhzhPexAN";
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    List<TetfuPage> pages = tetfu.decode(value);
    assertThat(pages).hasSize(1);
    assertThat(pages.get(0)).returns(ColorType.I, TetfuPage::getColorType).returns(Rotate.Spawn, TetfuPage::getRotate).returns(5, TetfuPage::getX).returns(0, TetfuPage::getY).returns("", TetfuPage::getComment);
    assertField(ColoredFieldFactory.createColoredField("IIII______"), pages.get(0).getField());
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 40 with MinoFactory

use of core.mino.MinoFactory in project solution-finder by knewjade.

the class TetfuTest method decode7.

@Test
void decode7() throws Exception {
    String value = "+gH8AeI8BeH8AeI8KeAgHvhBpoBAAA";
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    List<TetfuPage> pages = tetfu.decode(value);
    assertThat(pages).hasSize(3);
    assertThat(pages.get(0)).returns(ColorType.Empty, TetfuPage::getColorType);
    assertThat(pages.get(1)).returns(ColorType.I, TetfuPage::getColorType);
    assertThat(pages.get(2)).returns(ColorType.Empty, TetfuPage::getColorType);
    assertField(ColoredFieldFactory.createColoredField("" + "_XXXXXXXXI" + "_XXXXXXXXI"), pages.get(2).getField());
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Aggregations

MinoFactory (core.mino.MinoFactory)113 Test (org.junit.jupiter.api.Test)70 MinoShifter (core.mino.MinoShifter)59 LongTest (module.LongTest)51 Field (core.field.Field)45 MinoRotation (core.srs.MinoRotation)40 ColorConverter (common.tetfu.common.ColorConverter)33 Piece (core.mino.Piece)28 Action (common.datastore.action.Action)22 ColumnField (core.column_field.ColumnField)22 Randoms (lib.Randoms)22 InOutPairField (searcher.pack.InOutPairField)21 LockedReachable (core.action.reachable.LockedReachable)17 PerfectValidator (searcher.common.validator.PerfectValidator)17 LockedCandidate (core.action.candidate.LockedCandidate)16 MinoOperationWithKey (common.datastore.MinoOperationWithKey)15 List (java.util.List)15 Collectors (java.util.stream.Collectors)15 PermutationIterable (common.iterable.PermutationIterable)12 LockedReachableThreadLocal (concurrent.LockedReachableThreadLocal)12