Package com.amirhn.Game
Class Chess
java.lang.Object
com.amirhn.Game.Chess
The type Chess.
-
Field Summary
Modifier and TypeFieldDescriptionThe Black player.The History.The Moves.static final String
The constant OriginalFen.The Turn.The White player. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Apply move boolean.Gets allowed moves.getBoard()
Gets board.Gets opponent player.Gets player.Gets random move.Gets status.Gets turn player.boolean
Is 50 move rule boolean.boolean
Is checkmate boolean.boolean
isDraw()
Is draw boolean.boolean
Is in check boolean.boolean
Is stalemate boolean.boolean
Is threefold repetition boolean.moveFromString
(String moveString) Move from string move.void
Sets piece.void
Sets fen.toString()
To string string.void
undoMove()
Undo move.
-
Field Details
-
OriginalFen
The constant OriginalFen.- See Also:
-
whitePlayer
The White player. -
blackPlayer
The Black player. -
moves
The Moves. -
turn
The Turn. -
history
The History.
-
-
Constructor Details
-
Chess
public Chess()Instantiates a new Chess. -
Chess
Instantiates a new Chess.- Parameters:
fen
- the fen
-
-
Method Details
-
setupFEN
Sets fen.- Parameters:
fen
- the fen
-
setPiece
Sets piece.- Parameters:
piece
- the piece
-
getBoard
Gets board.- Returns:
- the board
-
getTurnPlayer
Gets turn player.- Returns:
- the turn player
-
getOpponentPlayer
Gets opponent player.- Returns:
- the opponent player
-
getPlayer
Gets player.- Parameters:
color
- the color- Returns:
- the player
-
getAllowedMoves
Gets allowed moves.- Returns:
- the allowed moves
-
getRandomMove
Gets random move.- Returns:
- the random move
-
applyMove
Apply move boolean.- Parameters:
move
- the move- Returns:
- the boolean
-
isInCheck
public boolean isInCheck()Is in check boolean.- Returns:
- the boolean
-
isCheckmate
public boolean isCheckmate()Is checkmate boolean.- Returns:
- the boolean
-
isStalemate
public boolean isStalemate()Is stalemate boolean.- Returns:
- the boolean
-
isThreefoldRepetition
public boolean isThreefoldRepetition()Is threefold repetition boolean.- Returns:
- the boolean
-
is50MoveRule
public boolean is50MoveRule()Is 50 move rule boolean.- Returns:
- the boolean
-
isDraw
public boolean isDraw()Is draw boolean.- Returns:
- the boolean
-
getStatus
Gets status.- Returns:
- the status
-
undoMove
public void undoMove()Undo move. -
moveFromString
Move from string move.- Parameters:
moveString
- the move string- Returns:
- the move
-
toString
To string string.
-