|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectsuicideChess.Move
public class Move
This class is used for moves representation.
| Nested Class Summary | |
|---|---|
class |
Move.NotAValidMoveException
|
| Constructor Summary | |
|---|---|
Move(Square fromSquare,
Square toSquare,
Piece movingPiece,
Piece capturePiece,
Piece promotionPiece)
This is the constructor of the class. |
|
Move(Square fromSquare,
Square toSquare,
Square enPassantSquare,
Piece movingPiece,
boolean isCapture)
This is the constructor of the class. |
|
Move(java.lang.String move,
Board board)
This is the constructor of the class. |
|
| Method Summary | |
|---|---|
void |
display()
Displays a move in great details. |
boolean |
enablesEnPassant()
Returns a boolean saying is a Move makes 'en passant' move possible. |
Square |
fromSquare()
Returns the Square to move from in a Move |
Piece |
getCapturedPiece()
Returns the Piece to be captured in a Move |
Square |
getEnPassantSquare()
Returns the enPassant Square for a move. |
Piece |
getMovingPiece()
Returns the moving Piece of a Move. |
Piece |
getPromotionPiece()
Returns the promotion Piece of a Move |
boolean |
isCaptureMove()
Returns a boolean saying if a Move is a capture move |
boolean |
isEnPassant()
Returns a boolean saying is a Move is an 'en passant' move. |
boolean |
isPromotionMove()
Returns a boolean saying if a Move is a promotion or not. |
boolean |
isSimpleEqual(Move that)
Tests the equality of two moves by just looking at the fromSquare and the toSquare |
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 |
|---|
public Move(java.lang.String move,
Board board)
throws Move.NotAValidMoveException,
Square.NotAValidSquare
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.
Move.NotAValidMoveException - When the String is not legal (too long or too short).
Square.NotAValidSquare - It the String is not legal (not standard algebraic notation).Board
public Move(Square fromSquare,
Square toSquare,
Piece movingPiece,
Piece capturePiece,
Piece promotionPiece)
throws Square.NotAValidSquare
fromSquare - The Square to move from.toSquare - The Square to move to.movingPiece - The Piece to be moved.capturePiece - The Piece to be captured. Piece.NONE if none.promotionPiece - The {link Piece} to be promoted to. Piece.NONE if none.
Square.NotAValidSquare - If Squares are not valid.Square,
Piece
public Move(Square fromSquare,
Square toSquare,
Square enPassantSquare,
Piece movingPiece,
boolean isCapture)
throws Square.NotAValidSquare
fromSquare - The Square to move from.toSquare - The Square to move to.enPassantSquare - The 'en passant' Square.movingPiece - The Piece to be moved.isCapture - This boolean is used to differenciate 'en passant' captures from moves that simply enable 'en passant' capture.
Square.NotAValidSquare - If Squares are not valid.Square,
Piece| Method Detail |
|---|
public Square fromSquare()
Square to move from in a Move
Squarepublic Square toSquare()
Square to move to in a Move
Squarepublic boolean isPromotionMove()
public Piece getPromotionPiece()
Piece of a Move
Piecepublic Piece getMovingPiece()
Piece of a Move.
Piecepublic boolean isCaptureMove()
public Piece getCapturedPiece()
Piece to be captured in a Move
public boolean enablesEnPassant()
public boolean isEnPassant()
public Square getEnPassantSquare()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isSimpleEqual(Move that)
that - A move to test
public void display()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||