Search in sources :

Example 1 with ArrayColoredField

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");
}
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 2 with ArrayColoredField

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");
}
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 3 with ArrayColoredField

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);
}
Also used : TetfuPage(common.tetfu.TetfuPage) Tetfu(common.tetfu.Tetfu) ArrayColoredField(common.tetfu.field.ArrayColoredField)

Aggregations

ArrayColoredField (common.tetfu.field.ArrayColoredField)3 ColorConverter (common.tetfu.common.ColorConverter)2 MinoFactory (core.mino.MinoFactory)2 LongTest (module.LongTest)2 Test (org.junit.jupiter.api.Test)2 Tetfu (common.tetfu.Tetfu)1 TetfuPage (common.tetfu.TetfuPage)1