// Path: core/src/dev/lonami/klooni/interfaces/IEffect.java
// public interface IEffect {
//     void setInfo(Cell deadCell, Vector2 culprit);
// 
//     void draw(Batch batch);
// 
//     boolean isDone();
// }
// 
// Path: core/src/dev/lonami/klooni/interfaces/IEffectFactory.java
// public interface IEffectFactory {
//     String getName();
// 
//     String getDisplay();
// 
//     int getPrice();
// 
//     IEffect create(final Cell deadCell, final Vector2 culprit);
// }
// 
// Path: core/src/dev/lonami/klooni/serializer/BinSerializable.java
// public interface BinSerializable {
//     void write(final DataOutputStream out) throws IOException;
// 
//     void read(final DataInputStream in) throws IOException;
// }


import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import dev.lonami.klooni.interfaces.IEffect;
import dev.lonami.klooni.interfaces.IEffectFactory;
import dev.lonami.klooni.serializer.BinSerializable;
        return putPiece(piece, x, y);
    }

    Vector2 snapToGrid(final Piece piece, final Vector2 position) {
        // Snaps the given position (e.g. mouse) to the grid,
        // assuming piece wants to be put at the specified position.
        // If the piece was not on the grid, the original position is returned
        //
        // Logic to determine the x and y is a copy-paste from putScreenPiece
        final Vector2 local = position.cpy().sub(pos);
        int x = MathUtils.round(local.x / piece.cellSize);
        int y = MathUtils.round(local.y / piece.cellSize);
        if (canPutPiece(piece, x, y))
            return new Vector2(pos.x + x * piece.cellSize, pos.y + y * piece.cellSize);
        else
            return position;
    }

    // This will clear both complete rows and columns, all at once.
    // The reason why we can't check first rows and then columns
    // (or vice versa) is because the following case (* filled, _ empty):
    //
    // 4x4 boardHeight    piece
    // _ _ * *      * *
    // _ * * *      *
    // * * _ _
    // * * _ _
    //
    // If the piece is put on the top left corner, all the cells will be cleared.
    // If we first cleared the columns, then the rows wouldn't have been cleared.
// Path: core/src/dev/lonami/klooni/interfaces/IEffect.java
// public interface IEffect {
//     void setInfo(Cell deadCell, Vector2 culprit);
// 
//     void draw(Batch batch);
// 
//     boolean isDone();
// }
// 
// Path: core/src/dev/lonami/klooni/interfaces/IEffectFactory.java
// public interface IEffectFactory {
//     String getName();
// 
//     String getDisplay();
// 
//     int getPrice();
// 
//     IEffect create(final Cell deadCell, final Vector2 culprit);
// }
// 
// Path: core/src/dev/lonami/klooni/serializer/BinSerializable.java
// public interface BinSerializable {
//     void write(final DataOutputStream out) throws IOException;
// 
//     void read(final DataInputStream in) throws IOException;
// }


// Path: core/src/dev/lonami/klooni/game/Board.java
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import dev.lonami.klooni.interfaces.IEffect;
import dev.lonami.klooni.interfaces.IEffectFactory;
import dev.lonami.klooni.serializer.BinSerializable;

        return putPiece(piece, x, y);
    }

    Vector2 snapToGrid(final Piece piece, final Vector2 position) {
        // Snaps the given position (e.g. mouse) to the grid,
        // assuming piece wants to be put at the specified position.
        // If the piece was not on the grid, the original position is returned
        //
        // Logic to determine the x and y is a copy-paste from putScreenPiece
        final Vector2 local = position.cpy().sub(pos);
        int x = MathUtils.round(local.x / piece.cellSize);
        int y = MathUtils.round(local.y / piece.cellSize);
        if (canPutPiece(piece, x, y))
            return new Vector2(pos.x + x * piece.cellSize, pos.y + y * piece.cellSize);
        else
            return position;
    }

    // This will clear both complete rows and columns, all at once.
    // The reason why we can't check first rows and then columns
    // (or vice versa) is because the following case (* filled, _ empty):
    //
    // 4x4 boardHeight    piece
    // _ _ * *      * *
    // _ * * *      *
    // * * _ _
    // * * _ _
    //
    // If the piece is put on the top left corner, all the cells will be cleared.
    // If we first cleared the columns, then the rows wouldn't have been cleared.
    public int clearComplete(final IEffectFactory effect) {