public class ChessHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static ChessBoardModel |
applyMove(ChessRules rules,
ChessPosition position,
ChessMovePath move)
Convenient method to apply a move on a position.
|
static ChessBoardModel |
applyMoveAndSwitch(ChessRules rules,
ChessPosition position,
ChessMovePath move)
Convenient method to apply a move on a position and switch the next player flag.
|
static boolean |
isCheck(ChessRules rules,
ChessPosition position,
ChessMovePath move,
boolean swapSides)
Check if a move would lead to a Check situation.
|
static boolean |
isCheckMate(ChessRules rules,
ChessPosition position,
ChessMovePath move)
Check if a move would lead to a Checkmate situation.
|
static ChessPosition |
movesToPosition(ChessRules chessRules,
PgnMarshaller pgnMarshaller,
Collection<String> moves) |
public static boolean isCheck(ChessRules rules, ChessPosition position, ChessMovePath move, boolean swapSides) throws IllegalMoveException
rules - the chess rules componentposition - the initial positionmove - the move to checkswapSides - if true check if the move would lead to a check in favor of the player moving, if false for the
opponent.IllegalMoveExceptionpublic static boolean isCheckMate(ChessRules rules, ChessPosition position, ChessMovePath move)
rules - the chess rules componentposition - the initial positionmove - the move to checkIllegalMoveExceptionpublic static ChessBoardModel applyMove(ChessRules rules, ChessPosition position, ChessMovePath move) throws IllegalMoveException
rules - the chess rules componentposition - the initial positionmove - the move to applyIllegalMoveExceptionpublic static ChessBoardModel applyMoveAndSwitch(ChessRules rules, ChessPosition position, ChessMovePath move) throws IllegalMoveException
rules - the chess rules componentposition - the initial positionmove - the move to applyIllegalMoveExceptionpublic static ChessPosition movesToPosition(ChessRules chessRules, PgnMarshaller pgnMarshaller, Collection<String> moves)
Copyright © 2016. All Rights Reserved.