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