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);
}
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");
}
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());
}
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");
}
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");
}
Aggregations