********************** Boards ********************** Everything to do with chess boards Board ========== .. class:: interface Board, M : Move, GM: GameMove, P: Piece, C: Coordinate> Methods ------- .. function:: fun getBoardState(): Array> Returns a 2D representation of the board in terms of pieces. Coordinates with no pieces are null in the resulting array. **TODO: Change getBoardState to return a Map** .. function:: fun addPiece(coordinate: C, piece: P) Adds a piece P at coordinate C onto the board. .. function:: fun removePiece(coordinate: C, piece: P) Removes a piece P at coordinate C from the board. .. function:: fun getPieces(): List> Returns a list of pairs representing which coordinate each piece is on. **TODO: Change getPieces to return a Map** .. function:: fun getPieces(player: Player): List> Returns a list of pairs representing which coordinate each piece is on for the given player. **TODO: Change getPieces to return a Map** .. function:: fun getPiece(coordinate: C): P? Returns the piece on the given coordinate if there is one. Otherwise returns null. .. function:: fun getPieceCoordinate(piece: P): C? Returns the coordinate of a given piece by reference. Board2D ========== .. class:: class Board2D(val rows: Int, val cols: Int) : Board Implementation of the Board interface for a 2d square board. The board size is rows x cols and each coordinate can have upto one Piece2D.