Package com.amirhn.Pieces
Class Piece
java.lang.Object
com.amirhn.Pieces.Piece
The type Piece.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBeCapturedBy(Piece piece) Can be captured by boolean.copy()Copy piece.booleanEquals boolean.static PieceGenerate piece.static PieceGenerate piece.getAllowedMoves(Chess chess) Gets allowed moves.Gets location.getNaturalMoves(Board board) Gets natural moves.charGets symbol.getThreatenedLocations(Board board) Gets threatened locations.inthashCode()Hash code int.booleanhasMoved()Has moved boolean.booleanisAllowedToMove(Chess chess) Is allowed to move boolean.voidRemove location.voidsetLocation(Location location) Sets location.voidsetLocationBack(Location location) Sets location back.toString()To string string.
-
Field Details
-
type
The Type. -
color
The Color. -
location
The Location. -
moves
protected int movesThe Moves.
-
-
Constructor Details
-
Piece
Instantiates a new Piece.- Parameters:
type- the typecolor- the colorlocation- the location
-
-
Method Details
-
generate
Generate piece.- Parameters:
pieceType- the piece typecolor- the colorlocation- the location- Returns:
- the piece
-
generate
Generate piece.- Parameters:
fen- the fenlocation- the location- Returns:
- the piece
-
getLocation
Gets location.- Returns:
- the location
-
setLocation
Sets location.- Parameters:
location- the location
-
setLocationBack
Sets location back.- Parameters:
location- the location
-
removeLocation
public void removeLocation()Remove location. -
hasMoved
public boolean hasMoved()Has moved boolean.- Returns:
- the boolean
-
equals
Equals boolean. -
hashCode
public int hashCode()Hash code int. -
toString
To string string. -
isAllowedToMove
Is allowed to move boolean.- Parameters:
chess- the chess- Returns:
- the boolean
-
getAllowedMoves
Gets allowed moves.- Parameters:
chess- the chess- Returns:
- the allowed moves
-
canBeCapturedBy
Can be captured by boolean.- Parameters:
piece- the piece- Returns:
- the boolean
-
getSymbol
public char getSymbol()Gets symbol.- Returns:
- the symbol
-
getThreatenedLocations
Gets threatened locations.- Parameters:
board- the board- Returns:
- the threatened locations
-
getNaturalMoves
Gets natural moves.- Parameters:
board- the board- Returns:
- the natural moves
-
copy
Copy piece.- Returns:
- the piece
-