suicideChess
Class Move

java.lang.Object
  extended bysuicideChess.Move

public class Move
extends java.lang.Object

This class is used for moves representation.

Version:
$LastChangedRevision: 19 $, $LastChangedDate: 2006-01-10 12:35:32 +0000 (Tue, 10 Jan 2006) $
Author:
Jean-Baptiste Hétier

Nested Class Summary
 class Move.NotAValidMoveException
           
 
Constructor Summary
Move(java.lang.String move, Board board)
          This is the constructor of the class.
 
Method Summary
 void display()
          Displays a move in great details.
 suicideChess.Square fromSquare()
          Returns the Square to move from in a Move
 suicideChess.Piece getCapturedPiece()
          Returns the Piece to be captured in a Move
 suicideChess.Piece getMovingPiece()
          Returns the moving piece of a Move.
 suicideChess.Piece getPromotionPiece()
          Returns the promotion Piece of a Move
 boolean isCaptureMove()
          Returns a boolean saying if a Move is a capture move
 boolean isPromotionMove()
          Returns a boolean saying if a Move is a promotion or not.
 suicideChess.Square toSquare()
          Returns the Square to move to in a Move
 java.lang.String toString()
          Converts a Move into a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Move

public Move(java.lang.String move,
            Board board)
     throws Move.NotAValidMoveException,
            suicideChess.Square.NotAValidSquare
This is the constructor of the class.

Parameters:
move - A String containing of type "e2e4" (4 chars), "b7b8q" (5 chars) for promotions. It is the standard algebraic notation used for chess.
board - A Board to be able to locate the pieces.
Throws:
Move.NotAValidMoveException - When the String is not legal (too long or too short).
NotAValidSquare - It the String is not legal (not standard algebraic notation).
suicideChess.Square.NotAValidSquare
See Also:
Board
Method Detail

fromSquare

public suicideChess.Square fromSquare()
Returns the Square to move from in a Move

Returns:
Square
See Also:
Square

toSquare

public suicideChess.Square toSquare()
Returns the Square to move to in a Move

Returns:
Square
See Also:
Square

isPromotionMove

public boolean isPromotionMove()
Returns a boolean saying if a Move is a promotion or not.

Returns:
boolean

getPromotionPiece

public suicideChess.Piece getPromotionPiece()
Returns the promotion Piece of a Move

Returns:
Piece
See Also:
Piece

getMovingPiece

public suicideChess.Piece getMovingPiece()
Returns the moving piece of a Move.

Returns:
Piece
See Also:
Piece

isCaptureMove

public boolean isCaptureMove()
Returns a boolean saying if a Move is a capture move

Returns:
boolean

getCapturedPiece

public suicideChess.Piece getCapturedPiece()
Returns the Piece to be captured in a Move

Returns:
Piece

toString

public java.lang.String toString()
Converts a Move into a String.

Returns:
String

display

public void display()
Displays a move in great details.