Search in sources :

Example 91 with MinoFactory

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

the class TetfuTest method encode7.

@Test
void encode7() throws Exception {
    List<TetfuElement> elements = Arrays.asList(TetfuElement.createFieldOnly(ColoredFieldFactory.createColoredField("XXXXLLXXXX")), TetfuElement.createFieldOnly(ColoredFieldFactory.createColoredField("XXXXJJXXXX")));
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("bhD8hlD8JeAgHbhD8h0D8JeAAA");
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 92 with MinoFactory

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

the class TetfuTest method encode5.

@Test
void encode5() throws Exception {
    MinoFactory factory = new MinoFactory();
    ArrayColoredField field = new ArrayColoredField(Tetfu.TETFU_MAX_HEIGHT);
    field.putMino(factory.create(Piece.I, Rotate.Spawn), 1, 0);
    List<TetfuElement> elements = Collections.singletonList(new TetfuElement(field, ColorType.I, Rotate.Reverse, 6, 0));
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("bhzhPehQJ");
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) ArrayColoredField(common.tetfu.field.ArrayColoredField) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 93 with MinoFactory

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

the class TetfuTest method decode5.

@Test
void decode5() throws Exception {
    String value = "bhzhFeH8Bex4OvhAAAA";
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    List<TetfuPage> pages = tetfu.decode(value);
    assertThat(pages).hasSize(2);
    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());
    assertThat(pages.get(1)).returns(ColorType.Empty, TetfuPage::getColorType).returns("", TetfuPage::getComment);
    assertField(ColoredFieldFactory.createColoredField("" + "__IIIIIIII" + "__XXXXXXXX"), pages.get(1).getField());
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 94 with MinoFactory

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

the class TetfuTest method encodeQuiz1.

@Test
void encodeQuiz1() throws Exception {
    List<Piece> orders = Collections.singletonList(L);
    String quiz = Tetfu.encodeForQuiz(orders);
    List<TetfuElement> elements = Collections.singletonList(new TetfuElement(ColorType.L, Rotate.Right, 0, 1, quiz));
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("vhAKJYUAFLDmClcJSAVDEHBEooRBMoAVB");
}
Also used : Piece(core.mino.Piece) ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 95 with MinoFactory

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

the class TetfuTest method encode2.

@Test
void encode2() throws Exception {
    List<TetfuElement> elements = Arrays.asList(new TetfuElement(ColorType.L, Rotate.Spawn, 4, 0), new TetfuElement(ColorType.J, Rotate.Spawn, 8, 0), new TetfuElement(ColorType.I, Rotate.Left, 6, 1), new TetfuElement(ColorType.S, Rotate.Spawn, 4, 1), new TetfuElement(ColorType.Z, Rotate.Spawn, 8, 1), new TetfuElement(ColorType.T, Rotate.Spawn, 4, 3), new TetfuElement(ColorType.O, Rotate.Spawn, 0, 0), new TetfuElement(ColorType.J, Rotate.Right, 0, 3));
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("vhHSQJWyBJnBXmBUoBVhBTpBOfB");
}
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