|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPiece
Pawn
public class Pawn
This class contains information and methods related to uncrowned pieces.
| Field Summary |
|---|
| Fields inherited from class Piece |
|---|
checkerNumber, color, coord, isNull, player, pos, width |
| Constructor Summary | |
|---|---|
Pawn()
This is a contructor that takes no params. |
|
Pawn(int x,
int y,
int w,
java.awt.Color c,
Player owner,
int n)
This constructor initializs all the necessary information for the Pawn class public |
|
Pawn(Piece checker)
This is a contructor. |
|
| Method Summary | |
|---|---|
void |
drawChecker(java.awt.Graphics g)
This method draws a king at the piece's location. |
boolean |
isKing()
This method returns a boolean if the Piece is a king. |
boolean |
isMoveValid(boolean isBlackSquare,
boolean isNotEmpty,
int c,
int r,
Board b)
This method checks to see if a king move is valid. |
| Methods inherited from class Piece |
|---|
executeMove, getCheckerNumber, getCol, getColor, getRow, getWidth, getXpos, getYpos, hasBeenJumped, isNull, setCheckerNumber, setCol, setColor, setRow, setWidth, setXpos, setYpos |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Pawn(int x,
int y,
int w,
java.awt.Color c,
Player owner,
int n)
x - x coordinatey - y coordinatew - widthc - color of the Pawnowner - an instance of Playern - the number of the current Pawnpublic Pawn()
public Pawn(Piece checker)
checker - An instance of Piece| Method Detail |
|---|
public boolean isKing()
isKing in class Piece
public boolean isMoveValid(boolean isBlackSquare,
boolean isNotEmpty,
int c,
int r,
Board b)
isMoveValid in class PieceisBlackSquare - true if the current square is occupiableisNotEmpty - true if the current square is occupiedc - the x postion of the square that holds the pawnr - the y postion of the square that holds the pawnb - a reference to the board
public void drawChecker(java.awt.Graphics g)
drawChecker in class Pieceg - passed Graphic instance
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||