Board

interface Board<B : Board<B, MG, P, C>, MG : MoveGenerator<B, MG, P, C>, P : Piece<B, MG, P, C>, C : Coordinate>

Represents chess board

Parameters

B

the type of a board.

MG

the type of a move generator.

P

the type of a piece.

C

the type of a coordinate.

Functions

addPiece
Link copied to clipboard
abstract fun addPiece(coordinate: C, piece: P)
Adds a piece at given coordinate onto the board.
clearBoard
Link copied to clipboard
abstract 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
abstract fun getBoardState(): Map<C, P?>
Returns the current status of the board in terms of board
getPiece
Link copied to clipboard
abstract fun getPiece(coordinate: C): P?
Returns the piece placed on a given coordinate by reference
getPieceCoordinate
Link copied to clipboard
abstract fun getPieceCoordinate(piece: P): C?
Returns the coordinate of a given piece by reference
getPieces
Link copied to clipboard
abstract fun getPieces(): List<Pair<P, C>>
Returns a list of pairs of all pieces and the corresponding coordinate that the piece is placed on
abstract fun getPieces(player: Player): List<Pair<P, C>>
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
removePiece
Link copied to clipboard
abstract fun removePiece(coordinate: C, piece: P)
Removes a piece at given coordinate from the board.
toString
Link copied to clipboard
open fun toString(): String

Inheritors

Board2D
Link copied to clipboard
Board3D
Link copied to clipboard
BoardHex
Link copied to clipboard