use of common.tetfu.field.ArrayColoredField 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");
}
use of common.tetfu.field.ArrayColoredField 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 common.tetfu.field.ArrayColoredField in project solution-finder by knewjade.
the class DevRandomEntryPoint method getTetfu.
private ColoredField getTetfu(MinoFactory minoFactory, ColorConverter converter) throws FinderParseException {
if (!code.isEmpty()) {
Tetfu tetfu = new Tetfu(minoFactory, converter);
String removeDomainData = Tetfu.removeDomainData(code);
String data = Tetfu.removePrefixData(removeDomainData);
List<TetfuPage> decode = tetfu.decode(data);
TetfuPage lastPage = decode.get(decode.size() - 1);
return lastPage.getField();
}
return new ArrayColoredField(Tetfu.TETFU_MAX_HEIGHT);
}
Aggregations