Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

antichess
Class King  view King download King.java

java.lang.Object
  extended byantichess.Piece
      extended byantichess.King

public class King
extends Piece

This class contains the rules that apply to King. It implements castling as a special move.


Field Summary
(package private)  int[] cDCol
           
(package private)  int[] cDRow
           
(package private)  int cOffsets
           
(package private)  int[][] cPieceCount
           
(package private)  int[][] cPieceType
           
(package private)  int[][] cSlide
           
 
Fields inherited from class antichess.Piece
BISHOP, BLACK, BLUE, dcol, drow, EMPTY, FIRSTCOLOR, FIRSTPIECE, KING, KNIGHT, LASTCOLOR, LASTPIECE, offsets, PAWN, PIECECOUNT, PIECEVALUE, playerColorString, QUEEN, RED, ROOK, slide, WHITE
 
Constructor Summary
King(char letter, Board b, int col, int row, int color)
          Creates a new piece.
 
Method Summary
 Piece copyPiece(Board b)
          Creates a copy to a new board
private  java.util.List getCastlingMoves()
          Returns a list of castling moves the King can make
Overrides getSpecialMoves in Piece.
 java.util.List getOtherMoves()
          Overrides getOtherMoves in Piece and retrieves castling moves.
 boolean inCheck()
           
 boolean inCheckAll()
           
 boolean inCheckOld()
           
 void makeOtherMove(Move move)
          Overrides makeOtherMove in Piece.
 void undoOtherMove(Move move)
          Overrides undoOtherMove in Piece.
 
Methods inherited from class antichess.Piece
addEmpty, canAttackLocation, equals, equals, getAllValidMoves, getBoard, getChar, getCol, getColor, getLastCol, getLastRow, getMoved, getNormalMoves, getOpponentColor, getOpponentColor, getRow, getStandardValidMoves, getSwitchMoves, getType, getValidMoves, getValidMovesNormalChess, isGameOver, isGameOver, isGameOverNormalChess, isLoseNormalChess, isTie, isTie, isTieNormalChess, isValidMove, isWin, isWin, kingInCheck, makeCaptureMove, makeGeneratedMove, makeGeneratedMove, makeMove, makeMove, makeMove, makeMove, setBoard, setColor, setLastLocation, setLocation, setMoved, swapPieces, toString, undoCaptureMove, undoMove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cOffsets

int cOffsets

cDCol

int[] cDCol

cDRow

int[] cDRow

cPieceCount

int[][] cPieceCount

cPieceType

int[][] cPieceType

cSlide

int[][] cSlide
Constructor Detail

King

public King(char letter,
            Board b,
            int col,
            int row,
            int color)
Creates a new piece.

Method Detail

copyPiece

public Piece copyPiece(Board b)
Creates a copy to a new board

Overrides:
copyPiece in class Piece

getOtherMoves

public java.util.List getOtherMoves()
Overrides getOtherMoves in Piece and retrieves castling moves.

Overrides:
getOtherMoves in class Piece

getCastlingMoves

private java.util.List getCastlingMoves()
Returns a list of castling moves the King can make
Overrides getSpecialMoves in Piece.


inCheckOld

public boolean inCheckOld()

inCheckAll

public boolean inCheckAll()

makeOtherMove

public void makeOtherMove(Move move)
Overrides makeOtherMove in Piece. Implements castling

Overrides:
makeOtherMove in class Piece

undoOtherMove

public void undoOtherMove(Move move)
Overrides undoOtherMove in Piece. Implements undo castling

Overrides:
undoOtherMove in class Piece

inCheck

public boolean inCheck()