chessgame

RESTful chessgame developed with kotlin

View on GitHub

htwdd.chessgame.server.model / Match

Match

data class Match

Represent a chess match

Author Felix Dimmel

Constructors

<init> Match(id: Int = 0, players: HashMap<PieceColor, Player> = HashMap(), playerWhite: Player? = null, playerBlack: Player? = null, pieceSets: HashMap<PieceColor, PieceSet> = hashMapOf(WHITE to PieceSet(), BLACK to PieceSet()), currentColor: PieceColor = WHITE, history: MutableList<Draw> = mutableListOf(), kingsideCastling: HashMap<PieceColor, Boolean> = hashMapOf(WHITE to true, BLACK to true), queensideCastling: HashMap<PieceColor, Boolean> = hashMapOf(WHITE to true, BLACK to true), enPassantField: Field? = null, halfMoves: Int = 0, check: HashMap<PieceColor, Boolean> = hashMapOf(WHITE to false, BLACK to false), checkmate: Boolean = false, matchCode: String = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")
Represent a chess match

Properties

check var check: HashMap<PieceColor, Boolean>
Hash map of check value for each player. True if player is in check otherwise false.
checkmate var checkmate: Boolean
True if one player is checkmate
currentColor var currentColor: PieceColor
Color of player who is on the move.
enPassantField var enPassantField: Field?
Contains the field to throw en passant or null.
halfMoves var halfMoves: Int
Number of halfmoves since the last movement of a pawn or the last thrown piece.
history val history: MutableList<Draw>
Mutable list of played draws.
id val id: Int
The ID of this match. (Autogenerated by SQLite database)
kingsideCastling var kingsideCastling: HashMap<PieceColor, Boolean>
Hash map of possibility for kingside castling of each player.
matchCode var matchCode: String
All match information as Forsyth-Edwards-Notation (FEN)
pieceSets var pieceSets: HashMap<PieceColor, PieceSet>
Hash map of the pieceSets of the two players. Key: Color of player; Value: PieceSet
players val players: HashMap<PieceColor, Player>
Hash map of the players. Key: Color of player; Value: Player
queensideCastling var queensideCastling: HashMap<PieceColor, Boolean>
Hash map of possibility for queenside castling of each player.

Functions

setPieceSetsByMatchCode fun setPieceSetsByMatchCode(): Unit
Sets all match properties by match code (FEN)
updateByDraw fun updateByDraw(draw: Draw): Unit
Update match properties by given draw