package uk.mgrove.ac.soton.comp1206.component;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import uk.mgrove.ac.soton.comp1206.game.GamePiece;

public class PieceBoard extends GameBoard {

  /**
   * Logger
   */
  private static final Logger logger = LogManager.getLogger(PieceBoard.class);

  /**
   * Create a new GameBoard with its own internal grid, specifying the number of columns and rows, along with the
   * visual width and height.
   *
   * @param width  the visual width
   * @param height the visual height
   */
  public PieceBoard(double width, double height) {
    super(3, 3, width, height);
    enableFocus = false;
  }

  public void displayPiece(GamePiece piece) {
    logger.info("Displaying new piece: {}", piece.toString());
    grid.clearGrid();
    grid.playPiece(piece,1,1);
  }

  /**
   * Set whether an indicator should be shown on the middle block of the grid
   * @param value whether indicator should be shown
   */
  public void showMiddleIndicator(boolean value) {
    getBlock(1,1).showMiddleIndicator(value);
  }

}
