From 8e2af63c35e72028854e1f790c02119b914c1ac9 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Tue, 13 Aug 2019 06:16:10 +0200 Subject: [PATCH] Improved documentation in Board --- src/dev/kske/chess/board/Board.java | 34 ++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/dev/kske/chess/board/Board.java b/src/dev/kske/chess/board/Board.java index bdd4f0d..9079a81 100644 --- a/src/dev/kske/chess/board/Board.java +++ b/src/dev/kske/chess/board/Board.java @@ -460,12 +460,10 @@ public class Board implements Cloneable { // Fullmove counter log.setFullmoveCounter(Integer.parseInt(parts[5])); - - // TODO: Synchronize with game } /** - * @return A FEN-encoded string representing the board + * @return a FEN-encoded string representing the board */ public String toFEN() { StringBuilder sb = new StringBuilder(); @@ -564,26 +562,56 @@ public class Board implements Cloneable { return board; } + /** + * @param pos The position from which to return a piece + * @return The piece at the position + */ public Piece get(Position pos) { return boardArr[pos.x][pos.y]; } + /** + * Places a piece at a position. + * + * @param pos The position to place the piece at + * @param piece The piece to place + */ public void set(Position pos, Piece piece) { boardArr[pos.x][pos.y] = piece; } + /** + * @param move The move from which position to return a piece + * @return The piece at the position of the move + */ public Piece getPos(Move move) { return get(move.pos); } + /** + * @param move The move from which destination to return a piece + * @return The piece at the destination of the move + */ public Piece getDest(Move move) { return get(move.dest); } + /** + * Places a piece at the position of a move. + * + * @param move The move at which position to place the piece + * @param piece The piece to place + */ public void setPos(Move move, Piece piece) { set(move.pos, piece); } + /** + * Places a piece at the destination of a move. + * + * @param move The move at which destination to place the piece + * @param piece The piece to place + */ public void setDest(Move move, Piece piece) { set(move.dest, piece); }