Package com.amirhn.Pieces
Class Piece
java.lang.Object
com.amirhn.Pieces.Piece
The type Piece.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeCapturedBy
(Piece piece) Can be captured by boolean.copy()
Copy piece.boolean
Equals boolean.static Piece
Generate piece.static Piece
Generate piece.getAllowedMoves
(Chess chess) Gets allowed moves.Gets location.getNaturalMoves
(Board board) Gets natural moves.char
Gets symbol.getThreatenedLocations
(Board board) Gets threatened locations.int
hashCode()
Hash code int.boolean
hasMoved()
Has moved boolean.boolean
isAllowedToMove
(Chess chess) Is allowed to move boolean.void
Remove location.void
setLocation
(Location location) Sets location.void
setLocationBack
(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
-