BoardHex

class BoardHex(verticalLength: Int, maximumWidth: Int, outOfBoundsRegion: Region2D?) : Board<BoardHex, MoveGeneratorHex, PieceHex, Coordinate2D>

Implementation of the Board interface for a 2d square board. The board size is rows x cols and each coordinate can have upto one PieceHex.

Constructors

BoardHex
Link copied to clipboard
fun BoardHex(verticalLength: Int, maximumWidth: Int, outOfBoundsRegion: Region2D? = null)

Functions

addPiece
Link copied to clipboard
open override fun addPiece(coordinate: Coordinate2D, piece: PieceHex)
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<Coordinate2D, PieceHex?>
Returns the current status of the board in terms of board
getPiece
Link copied to clipboard
open override fun getPiece(coordinate: Coordinate2D): PieceHex?
Returns the piece placed on a given coordinate by reference
getPieceCoordinate
Link copied to clipboard
open override fun getPieceCoordinate(piece: PieceHex): Coordinate2D?
Returns the coordinate of a given piece by reference
getPieces
Link copied to clipboard
open override fun getPieces(): List<Pair<PieceHex, Coordinate2D>>
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<PieceHex, Coordinate2D>>
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: Coordinate2D): Boolean
Returns true if the given coordinate is valid on the board
removePiece
Link copied to clipboard
open override fun removePiece(coordinate: Coordinate2D, piece: PieceHex)
toString
Link copied to clipboard
open fun toString(): String

Properties

cols
Link copied to clipboard
val cols: Int
maximumWidth
Link copied to clipboard
val maximumWidth: Int
the number of columns (i.e.
rows
Link copied to clipboard
val rows: Int
verticalLength
Link copied to clipboard
val verticalLength: Int
the number of rows (i.e.