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