Search in sources :

Example 1 with BlockField

use of common.datastore.BlockField in project solution-finder by knewjade.

the class PathSettings method setFieldWithReserved.

void setFieldWithReserved(ColoredField coloredField, int height) {
    Field field = FieldFactory.createField(height);
    BlockField blockField = new BlockField(height);
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < 10; x++) {
            ColorConverter colorConverter = new ColorConverter();
            ColorType colorType = colorConverter.parseToColorType(coloredField.getBlockNumber(x, y));
            switch(colorType) {
                case Empty:
                    break;
                case Gray:
                    field.setBlock(x, y);
                    break;
                default:
                    Piece piece = colorConverter.parseToBlock(colorType);
                    blockField.setBlock(piece, x, y);
                    break;
            }
        }
    }
    setField(field);
    setReservedBlock(blockField);
}
Also used : Field(core.field.Field) BlockField(common.datastore.BlockField) ColoredField(common.tetfu.field.ColoredField) BlockField(common.datastore.BlockField) Piece(core.mino.Piece) ColorConverter(common.tetfu.common.ColorConverter) ColorType(common.tetfu.common.ColorType)

Example 2 with BlockField

use of common.datastore.BlockField in project solution-finder by knewjade.

the class OneFumenParser method createBlockField.

private BlockField createBlockField(List<MinoOperationWithKey> operations, int maxClearLine) {
    BlockField blockField = new BlockField(maxClearLine);
    for (MinoOperationWithKey key : operations) {
        Field test = createField(key, maxClearLine);
        Mino mino = key.getMino();
        blockField.merge(test, mino.getPiece());
    }
    return blockField;
}
Also used : BlockField(common.datastore.BlockField) Field(core.field.Field) ColoredField(common.tetfu.field.ColoredField) MinoOperationWithKey(common.datastore.MinoOperationWithKey) BlockField(common.datastore.BlockField) Mino(core.mino.Mino)

Example 3 with BlockField

use of common.datastore.BlockField in project solution-finder by knewjade.

the class EasyTetfu method encodeUrl.

public <T extends OperationWithKey> String encodeUrl(Field initField, List<T> operationWithKeys, int height) {
    Tetfu tetfu = new Tetfu(minoFactory, colorConverter);
    BlockField blockField = OperationTransform.parseToBlockField(operationWithKeys, minoFactory, height);
    TetfuElement elementOnePage = parseBlockFieldToTetfuElement(initField, colorConverter, blockField, "");
    return "http://fumen.zui.jp/?v115@" + tetfu.encode(Collections.singletonList(elementOnePage));
}
Also used : BlockField(common.datastore.BlockField) Tetfu(common.tetfu.Tetfu) TetfuElement(common.tetfu.TetfuElement)

Example 4 with BlockField

use of common.datastore.BlockField in project solution-finder by knewjade.

the class EasyTetfu method parseBlockFieldToTetfuElement.

private TetfuElement parseBlockFieldToTetfuElement(Field initField, ColorConverter colorConverter, BlockField blockField, String comment) {
    ColoredField coloredField = ColoredFieldFactory.createGrayField(initField);
    for (Piece piece : Piece.values()) {
        Field target = blockField.get(piece);
        ColorType colorType = colorConverter.parseToColorType(piece);
        fillInField(coloredField, colorType, target);
    }
    return new TetfuElement(coloredField, ColorType.Empty, Rotate.Reverse, 0, 0, comment);
}
Also used : BlockField(common.datastore.BlockField) Field(core.field.Field) ColoredField(common.tetfu.field.ColoredField) ColoredField(common.tetfu.field.ColoredField) Piece(core.mino.Piece) ColorType(common.tetfu.common.ColorType) TetfuElement(common.tetfu.TetfuElement)

Example 5 with BlockField

use of common.datastore.BlockField in project solution-finder by knewjade.

the class MoveEntryPoint method parseColorElement.

private TetfuElement parseColorElement(Field initField, ColorConverter colorConverter, BlockField blockField, String comment) {
    ColoredField coloredField = ColoredFieldFactory.createGrayField(initField);
    for (Piece piece : Piece.values()) {
        Field target = blockField.get(piece);
        ColorType colorType = colorConverter.parseToColorType(piece);
        fillInField(coloredField, colorType, target);
    }
    return new TetfuElement(coloredField, ColorType.Empty, Rotate.Reverse, 0, 0, comment);
}
Also used : BlockField(common.datastore.BlockField) Field(core.field.Field) ColoredField(common.tetfu.field.ColoredField) ColoredField(common.tetfu.field.ColoredField) Piece(core.mino.Piece) ColorType(common.tetfu.common.ColorType) TetfuElement(common.tetfu.TetfuElement)

Aggregations

BlockField (common.datastore.BlockField)11 Field (core.field.Field)8 ColoredField (common.tetfu.field.ColoredField)6 Piece (core.mino.Piece)6 TetfuElement (common.tetfu.TetfuElement)5 ColorType (common.tetfu.common.ColorType)5 MinoOperationWithKey (common.datastore.MinoOperationWithKey)4 ColorConverter (common.tetfu.common.ColorConverter)4 PatternGenerator (common.pattern.PatternGenerator)3 Operation (common.datastore.Operation)2 OperationWithKey (common.datastore.OperationWithKey)2 Pieces (common.datastore.blocks.Pieces)2 Tetfu (common.tetfu.Tetfu)2 Mino (core.mino.Mino)2 MinoFactory (core.mino.MinoFactory)2 MinoShifter (core.mino.MinoShifter)2 EntryPoint (entry.EntryPoint)2 SizedBit (searcher.pack.SizedBit)2 SyntaxException (common.SyntaxException)1 BuildUpStream (common.buildup.BuildUpStream)1