manager
Class ChessGame

java.lang.Object
  extended by manager.Game
      extended by manager.ChessGame

public class ChessGame
extends Game

This class extends the generic board game class Game to support a chess game.

Version:
0.5 beta - 03/15/2006
Author:
Luciano Antonio Digiampietri
See Also:
Game

Field Summary
 boolean CHECK
           
 boolean KING_PLAYER1_MOVED
           
 boolean KING_PLAYER2_MOVED
           
 Action LAST_ACTION
           
 boolean LEFT_ROOK_PLAYER1_MOVED
           
 boolean LEFT_ROOK_PLAYER2_MOVED
           
 boolean RIGHT_ROOK_PLAYER1_MOVED
           
 boolean RIGHT_ROOK_PLAYER2_MOVED
           
 boolean WAITING_FOR_CHOICE
           
 
Fields inherited from class manager.Game
BOARD, CONT_ID, DRAWN_GAME, GAME_ENDED, GAME_STARTED, GAME_TYPE, LAST_MESSAGE, MAX_PLAYERS, MIN_PLAYERS, PLAYERS, WAITING_PLAYERS, WINNER
 
Constructor Summary
ChessGame(java.lang.String name)
           
ChessGame(java.lang.String name, int player1)
           
 
Method Summary
 boolean add(int x, int y, java.lang.String Player)
           
 boolean canAdd(int x, int y, Piece P)
           
 boolean canEat(int x, int y, int x2, int y2, int Player)
           
 boolean canMove(int x1, int y1, int x2, int y2, int Player)
           
 boolean canMoveAux(int x1, int y1, int x2, int y2, int Player)
           
 boolean eat(int x, int y)
           
 Position findKing(int Player)
           
 boolean gameEnded()
           
 boolean inCheck(int Player)
           
 void initializeBoard()
           
 void insertPieces()
           
 boolean isAdversary(Piece P1, int Player)
           
 boolean move(int x1, int y1, int x2, int y2, int Player)
           
 boolean player1Won()
           
 boolean player2Won()
           
 void startGame()
           
 boolean thereIsSomeoneInTheWay(int x1, int y1, int x2, int y2)
           
 boolean won(int Player)
           
 
Methods inherited from class manager.Game
add, canAdd, currentBoard, endTurn, gameDraw, getActualPlayer, getColumns, getCurrentGameId, getGameName, getGameType, getLines, getMaxPlayers, getMessage, getMinPlayers, getPlayers, getStatus, joinGame, rotate, waitingPlayers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK

public boolean CHECK

WAITING_FOR_CHOICE

public boolean WAITING_FOR_CHOICE

LAST_ACTION

public Action LAST_ACTION

LEFT_ROOK_PLAYER1_MOVED

public boolean LEFT_ROOK_PLAYER1_MOVED

RIGHT_ROOK_PLAYER1_MOVED

public boolean RIGHT_ROOK_PLAYER1_MOVED

KING_PLAYER1_MOVED

public boolean KING_PLAYER1_MOVED

LEFT_ROOK_PLAYER2_MOVED

public boolean LEFT_ROOK_PLAYER2_MOVED

RIGHT_ROOK_PLAYER2_MOVED

public boolean RIGHT_ROOK_PLAYER2_MOVED

KING_PLAYER2_MOVED

public boolean KING_PLAYER2_MOVED
Constructor Detail

ChessGame

public ChessGame(java.lang.String name)

ChessGame

public ChessGame(java.lang.String name,
                 int player1)
Method Detail

startGame

public void startGame()

inCheck

public boolean inCheck(int Player)

findKing

public Position findKing(int Player)

move

public boolean move(int x1,
                    int y1,
                    int x2,
                    int y2,
                    int Player)
Overrides:
move in class Game

canMove

public boolean canMove(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int Player)
Overrides:
canMove in class Game

canMoveAux

public boolean canMoveAux(int x1,
                          int y1,
                          int x2,
                          int y2,
                          int Player)

isAdversary

public boolean isAdversary(Piece P1,
                           int Player)

eat

public boolean eat(int x,
                   int y)

canEat

public boolean canEat(int x,
                      int y,
                      int x2,
                      int y2,
                      int Player)

canAdd

public boolean canAdd(int x,
                      int y,
                      Piece P)

add

public boolean add(int x,
                   int y,
                   java.lang.String Player)

initializeBoard

public void initializeBoard()
Overrides:
initializeBoard in class Game

insertPieces

public void insertPieces()

gameEnded

public boolean gameEnded()
Overrides:
gameEnded in class Game

player1Won

public boolean player1Won()

player2Won

public boolean player2Won()

won

public boolean won(int Player)

thereIsSomeoneInTheWay

public boolean thereIsSomeoneInTheWay(int x1,
                                      int y1,
                                      int x2,
                                      int y2)