Class King

java.lang.Object
  extended by Piece
      extended by King

public class King
extends Piece

This class contains information and methods related to crowned pieces.


Field Summary
 
Fields inherited from class Piece
checkerNumber, color, coord, isNull, player, pos, width
 
Constructor Summary
King()
          This is a contructor that takes no params.
King(int x, int y, int w, java.awt.Color c, int n)
          This constructor initializs all the necessary information for the King class public
King(Piece checker)
          Constructor
 
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

King

public King(int x,
            int y,
            int w,
            java.awt.Color c,
            int n)
This constructor initializs all the necessary information for the King class public

Parameters:
x - x coordinate
y - y coordinate
w - width
c - color of the King
n - the number of the current King

King

public King(Piece checker)
Constructor

Parameters:
checker - Instance of Piece

King

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

Method Detail

isKing

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

Specified by:
isKing in class Piece
Returns:
True if the Piece is 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 king
r - the y postion of the square that holds the king
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. Signifies the king with a star in the middle. public

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