Search in sources :

Example 31 with MinoFactory

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

the class CoordinatesTest method walkSizeWithJ.

@Test
void walkSizeWithJ() {
    MinoFactory minoFactory = new MinoFactory();
    assertThat(Coordinates.walk(minoFactory.create(Piece.J, Rotate.Spawn), 4)).hasSize(24);
    assertThat(Coordinates.walk(minoFactory.create(Piece.J, Rotate.Left), 4)).hasSize(18);
    assertThat(Coordinates.walk(minoFactory.create(Piece.J, Rotate.Reverse), 4)).hasSize(24);
    assertThat(Coordinates.walk(minoFactory.create(Piece.J, Rotate.Right), 4)).hasSize(18);
}
Also used : MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test)

Example 32 with MinoFactory

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

the class OperationTransformTest method parseToOperationWithKeys.

@Test
void parseToOperationWithKeys() throws Exception {
    Field field = FieldFactory.createField("" + "____XXXXXX" + "____XXXXXX" + "____XXXXXX" + "____XXXXXX" + "");
    String base = "L,0,2,0;Z,R,2,2;O,0,0,1;L,2,1,1";
    Operations operations = OperationInterpreter.parseToOperations(base);
    MinoFactory minoFactory = new MinoFactory();
    List<MinoOperationWithKey> operationWithKeys = OperationTransform.parseToOperationWithKeys(field, operations, minoFactory, 4);
    String line = OperationWithKeyInterpreter.parseToString(operationWithKeys);
    assertThat(line).isEqualTo("L,0,2,0,0,1025;Z,R,2,2,0,1074791424;O,0,0,1,0,1049600;L,2,1,1,1049600,1073741825");
}
Also used : ColumnField(core.column_field.ColumnField) InOutPairField(searcher.pack.InOutPairField) Field(core.field.Field) MinoOperationWithKey(common.datastore.MinoOperationWithKey) MinoFactory(core.mino.MinoFactory) Operations(common.datastore.Operations) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 33 with MinoFactory

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

the class TetfuTest method decode2.

@Test
void decode2() throws Exception {
    String value = "bhzhPexAcFAooMDEPBAAA";
    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("hello", 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 34 with MinoFactory

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

the class TetfuTest method encode1.

@Test
void encode1() throws Exception {
    List<TetfuElement> elements = Collections.singletonList(new TetfuElement(ColorType.T, Rotate.Spawn, 5, 0));
    MinoFactory factory = new MinoFactory();
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("vhA1QJ");
}
Also used : ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 35 with MinoFactory

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

the class TetfuTest method encode4.

@Test
void encode4() 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.Spawn, 5, 0, ""));
    ColorConverter converter = new ColorConverter();
    Tetfu tetfu = new Tetfu(factory, converter);
    String encode = tetfu.encode(elements);
    assertThat(encode).isEqualTo("bhzhPexQJ");
}
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)

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