Class Board

java.lang.Object
com.amirhn.Game.Board

public class Board extends Object
The type Board.
  • Field Details

    • rows

      public final int rows
      The Rows.
    • columns

      public final int columns
      The Rows.
    • pieceByLocation

      public final Map<Location,Piece> pieceByLocation
      The Piece by location.
  • Constructor Details

    • Board

      public Board(int rows, int columns)
      Instantiates a new Board.
      Parameters:
      rows - the rows
      columns - the columns
  • Method Details

    • fromFEN

      public static Board fromFEN(String fen)
      From fen board.
      Parameters:
      fen - the fen
      Returns:
      the board
    • setupFEN

      public void setupFEN(String fen)
      Sets fen.
      Parameters:
      fen - the fen
    • isValidLocation

      public boolean isValidLocation(Location location)
      Is valid location boolean.
      Parameters:
      location - the location
      Returns:
      the boolean
    • isOccupied

      public boolean isOccupied(Location location)
      Is occupied boolean.
      Parameters:
      location - the location
      Returns:
      the boolean
    • getPiece

      public Piece getPiece(Location location)
      Gets piece.
      Parameters:
      location - the location
      Returns:
      the piece
    • setPiece

      public void setPiece(Piece piece)
      Sets piece.
      Parameters:
      piece - the piece
    • removePiece

      public void removePiece(Piece piece)
      Remove piece.
      Parameters:
      piece - the piece
    • getAllPieces

      public List<Piece> getAllPieces()
      Gets all pieces.
      Returns:
      the all pieces
    • isValidPiece

      public boolean isValidPiece(Piece piece)
      Is valid piece boolean.
      Parameters:
      piece - the piece
      Returns:
      the boolean
    • toString

      public String toString()
      To string string.
      Overrides:
      toString in class Object
      Returns:
      the string
    • copy

      public Board copy()
      Copy board.
      Returns:
      the board
    • equals

      public boolean equals(Object o)
      Equals boolean.
      Overrides:
      equals in class Object
      Parameters:
      o - the o
      Returns:
      the boolean