|
Internet Chess ToolKit v0.2.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ictk.boardgame.Piece ictk.boardgame.chess.ChessPiece
Field Summary | |
static byte |
BLACK_OFFSET
an offset for black pieces of the same INDEX value |
static byte |
NULL_PIECE
the null piece INDEX |
Constructor Summary | |
ChessPiece(byte ind,
boolean _isBlack,
int maxlegaldests,
int maxguards)
|
|
ChessPiece(byte ind,
boolean _isBlack,
Square _orig,
ChessBoard _board,
int maxlegaldests,
int maxguards)
|
|
ChessPiece(byte ind,
int maxlegaldests,
int maxguards)
|
Method Summary | |
java.lang.String |
dump()
|
Board |
getBoard()
return the Board that this Piece is associated with (though not necessarily on at the time of the call). |
java.util.List |
getGuardSquares()
returns the Squares that this piece guards (when it is the other sides turn to move. |
byte |
getIndex()
gets the Index for the type of piece in question. |
java.util.List |
getLegalDests()
returns the Squares that are legal destinations on this piece |
Square[] |
getLineOfSight(ChessPiece target,
boolean inclusive)
get all the squares between two squares along a line (diag or straight). |
Square[] |
getLineOfSight(int t_file,
int t_rank,
boolean inclusive)
|
Square[] |
getLineOfSight(Square target,
boolean inclusive)
|
ChessPiece |
getPinnedBy()
|
Square |
getSquare()
gets the square this piece is currently occupying. |
boolean |
isBishop()
|
boolean |
isBlack()
which side is this piece on? |
boolean |
isBlockable(Square blocker,
ChessPiece target)
checks to see if another piece may be able to intercede between the piece's origin and destination square |
boolean |
isCaptured()
has this piece been captured. |
boolean |
isGuarding(ChessPiece piece)
is this piece guarding the parameter piece. |
boolean |
isGuarding(Square dest)
is this piece guarding the destination Square? |
boolean |
isKing()
|
boolean |
isKnight()
|
boolean |
isLegalAttack(Square dest)
same as isLegalDests except for special moves like castle and pawn moves. |
boolean |
isLegalDest(Square dest)
checks the legalDests list to see if the destination is in that list. |
boolean |
isPawn()
|
boolean |
isQueen()
|
boolean |
isRook()
|
void |
removeLegalDests()
clears all legal destinations for this piece. |
void |
setBoard(ChessBoard b)
sets the chess board that this piece is on. |
void |
setCaptured(boolean t)
sets the piece captured or not. |
static ChessPiece |
toChessPiece(int i)
this factory method allows for easy conversion of indices to Piece objects of different types. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static byte NULL_PIECE
public static byte BLACK_OFFSET
Constructor Detail |
public ChessPiece(byte ind, int maxlegaldests, int maxguards)
ind
- is the piece indexmaxlegaldests
- max number of legal destinations for this piecemaxguards
- max number of guard squares for this piecepublic ChessPiece(byte ind, boolean _isBlack, int maxlegaldests, int maxguards)
ind
- is the piece index_isBlack
- is the piece black or whitemaxlegaldests
- max number of legal destinations for this piecemaxguards
- max number of guard squares for this piecepublic ChessPiece(byte ind, boolean _isBlack, Square _orig, ChessBoard _board, int maxlegaldests, int maxguards)
ind
- is the piece index_isBlack
- is the piece black or white_orig
- which square should it be placed on_board
- which board should it be onmaxlegaldests
- max number of legal destinations for this piecemaxguards
- max number of guard squares for this pieceMethod Detail |
public boolean isCaptured()
public void setCaptured(boolean t)
public ChessPiece getPinnedBy()
public boolean isBlack()
public void setBoard(ChessBoard b)
public boolean isLegalDest(Square dest)
dest
- - the target of the move, which needs to be considered
public boolean isLegalAttack(Square dest)
public java.util.List getLegalDests()
public void removeLegalDests()
public java.util.List getGuardSquares()
public boolean isGuarding(Square dest)
public boolean isGuarding(ChessPiece piece)
public Square[] getLineOfSight(ChessPiece target, boolean inclusive)
inclusive
- include the target square in the return set
public Square[] getLineOfSight(Square target, boolean inclusive)
public Square[] getLineOfSight(int t_file, int t_rank, boolean inclusive)
public boolean isBlockable(Square blocker, ChessPiece target)
blocker
- - the proposed square that can block the attacktarget
- - the piece under attack
public byte getIndex()
public Square getSquare()
public Board getBoard()
Piece
getBoard
in class Piece
public java.lang.String toString()
public boolean isKing()
public boolean isQueen()
public boolean isRook()
public boolean isBishop()
public boolean isKnight()
public boolean isPawn()
public static ChessPiece toChessPiece(int i)
public java.lang.String dump()
|
Submit a bug or feature Visit the Website Internet Chess ToolKit is licensed under the GPL v2 . |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |