Class Pawn

java.lang.Object
  extended by Piece
      extended by Pawn

public class Pawn
extends Piece

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

Pawn

public 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

Parameters:
x - x coordinate
y - y coordinate
w - width
c - color of the Pawn
owner - an instance of Player
n - the number of the current Pawn

Pawn

public Pawn()
This is a contructor that takes no params.


Pawn

public Pawn(Piece checker)
This is a contructor.

Parameters:
checker - An instance of Piece
Method Detail

isKing

public boolean isKing()
This method returns a boolean if the Piece is a king.

Specified by:
isKing in class Piece
Returns:
false if the Pawn is not a king

isMoveValid

public boolean isMoveValid(boolean isBlackSquare,
                           boolean isNotEmpty,
                           int c,
                           int r,
                           Board b)
This method checks to see if a king move is valid. public

Specified by:
isMoveValid in class Piece
Parameters:
isBlackSquare - true if the current square is occupiable
isNotEmpty - true if the current square is occupied
c - the x postion of the square that holds the pawn
r - the y postion of the square that holds the pawn
b - a reference to the board
Returns:
true if the move is valid

drawChecker

public void drawChecker(java.awt.Graphics g)
This method draws a king at the piece's location. public

Specified by:
drawChecker in class Piece
Parameters:
g - passed Graphic instance