Board3D

class Board3D(dims: Int, rows: Int, cols: Int, outOfBoundsRegion: Region3D?) : Board<Board3D, MoveGenerator3D, Piece3D, Coordinate3D>

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.

Constructors

Board3D
Link copied to clipboard
fun Board3D(dims: Int, rows: Int, cols: Int, outOfBoundsRegion: Region3D? = null)

Functions

addPiece
Link copied to clipboard
open override fun addPiece(coordinate: Coordinate3D, piece: Piece3D)
clearBoard
Link copied to clipboard
open override fun clearBoard()
Reinitialise the board by assigning null to all valid coordinate of the board
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getBoardState
Link copied to clipboard
open override fun getBoardState(): Map<Coordinate3D, Piece3D?>
Returns the current status of the board in terms of board
getPiece
Link copied to clipboard
open override fun getPiece(coordinate: Coordinate3D): Piece3D?
Returns the piece placed on a given coordinate by reference
getPieceCoordinate
Link copied to clipboard
open override fun getPieceCoordinate(piece: Piece3D): Coordinate3D?
Returns the coordinate of a given piece by reference
getPieces
Link copied to clipboard
open override fun getPieces(): List<Pair<Piece3D, Coordinate3D>>
Returns a list of pairs of all pieces and the corresponding coordinate that the piece is placed on
open override fun getPieces(player: Player): List<Pair<Piece3D, Coordinate3D>>
Returns a list of pairs of all pieces that a given player owns and the corresponding coordinate that the piece is placed on
hashCode
Link copied to clipboard
open fun hashCode(): Int
isInBounds
Link copied to clipboard
fun isInBounds(coordinate: Coordinate3D): Boolean
Returns true if the given coordinate is valid on the board
removePiece
Link copied to clipboard
open override fun removePiece(coordinate: Coordinate3D, piece: Piece3D)
toString
Link copied to clipboard
open fun toString(): String

Properties

cols
Link copied to clipboard
val cols: Int
the number of columns
dims
Link copied to clipboard
val dims: Int
the number of dimensions
rows
Link copied to clipboard
val rows: Int
the number of rows