Search in sources :

Example 16 with Tetfu

use of common.tetfu.Tetfu 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)

Example 17 with Tetfu

use of common.tetfu.Tetfu in project solution-finder by knewjade.

the class MoveSettingParser method encodeTetfu.

private List<TetfuPage> encodeTetfu(String encoded) throws FinderParseException {
    MinoFactory minoFactory = new MinoFactory();
    ColorConverter colorConverter = new ColorConverter();
    Tetfu tetfu = new Tetfu(minoFactory, colorConverter);
    String data = Tetfu.removePrefixData(encoded);
    if (data == null)
        throw new FinderParseException("Unsupported tetfu: data=" + encoded);
    return tetfu.decode(data);
}
Also used : FinderParseException(exceptions.FinderParseException) ColorConverter(common.tetfu.common.ColorConverter) MinoFactory(core.mino.MinoFactory) Tetfu(common.tetfu.Tetfu)

Aggregations

Tetfu (common.tetfu.Tetfu)17 ColorConverter (common.tetfu.common.ColorConverter)12 MinoFactory (core.mino.MinoFactory)12 FinderParseException (exceptions.FinderParseException)9 TetfuElement (common.tetfu.TetfuElement)7 TetfuPage (common.tetfu.TetfuPage)5 ColoredField (common.tetfu.field.ColoredField)5 List (java.util.List)5 Collectors (java.util.stream.Collectors)5 ColorType (common.tetfu.common.ColorType)4 CommandLineWrapper (entry.CommandLineWrapper)4 NormalCommandLineWrapper (entry.NormalCommandLineWrapper)4 IOException (java.io.IOException)4 Charset (java.nio.charset.Charset)4 Files (java.nio.file.Files)4 Path (java.nio.file.Path)4 Paths (java.nio.file.Paths)4 LinkedList (java.util.LinkedList)4 Optional (java.util.Optional)4 org.apache.commons.cli (org.apache.commons.cli)4