org.gChess
Class ChessPiece
java.lang.Object
org.gChess.ChessPiece
- Direct Known Subclasses:
- Bishop, King, Knight, Pawn, Queen, Rook
public abstract class ChessPiece
- extends java.lang.Object
This class contains all the base methods for each chess piece
Field Summary |
static int |
BLACK
apparently enums don't play to happily with limited cpu
cycles, so these will have to take up the slack. |
static int |
WHITE
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BLACK
public static final int BLACK
- apparently enums don't play to happily with limited cpu
cycles, so these will have to take up the slack.
These class vars are for determining the "team" aka color
of a ChessPiece
- See Also:
- Constant Field Values
WHITE
public static final int WHITE
- See Also:
- Constant Field Values
ChessPiece
public ChessPiece(int color,
Location loc,
ChessBoard cb)
canMove
public boolean canMove()
- return true if there are ANY valid locations we can move to;
returns false otherwise.
getValidMoveLocations
public java.util.ArrayList<Location> getValidMoveLocations()
- Returns:
- an ArrayList of Locations that we can move to
and that are not occupied.
moveTo
public void moveTo(Location loc)
getMoveLocations
public abstract java.util.ArrayList<Location> getMoveLocations()
- This method DOES NOT check that all returned locations are not occupied.
- Returns:
- an ArrayList of Locations that this chess piece potentially
could move to.
getLoc
public Location getLoc()
setLoc
public void setLoc(Location loc)
getColor
public int getColor()
getImage
public Drawable getImage()
loadImage
public void loadImage(int resource)
getBoard
public ChessBoard getBoard()