|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectklaus.chess.Move
public class Move
Represents a half-move
Field Summary | |
---|---|
private boolean |
check
|
private boolean |
checkmate
|
private boolean |
ep
|
private int |
fromX
The original X coordinate |
private int |
fromY
The original Y coordinate |
private static char[] |
lines
|
private boolean |
longCastling
|
private Position |
newPosition
|
static Move |
NO_NEW_MOVE
|
private char |
piece
|
private char |
promotion
|
private static char[] |
rows
|
private boolean |
shortCastling
|
private boolean |
stalemate
|
private boolean |
take
|
private int |
toX
The new X coordinate |
private int |
toY
The new Y coordinate |
Constructor Summary | |
---|---|
Move(int fromX,
int fromY,
int toX,
int toY)
Creates a new move |
|
Move(int fromX,
int fromY,
int toX,
int toY,
char promotion)
Creates a new move with pawn promotion |
|
Move(String engineMove,
Position position)
Creates a move from an engine's string |
Method Summary | |
---|---|
Position |
applyMoveTo(Position pos)
This applies this move to a position and returns a new position with the given move done. |
boolean |
equals(Object obj)
|
int |
getFromX()
|
int |
getFromY()
|
String |
getNotation(Position oldPosition)
|
char |
getPromotion()
|
int |
getToX()
|
int |
getToY()
|
int |
hashCode()
|
void |
setFromX(int fromX)
|
void |
setFromY(int fromY)
|
void |
setPromotion(char promotion)
|
void |
setToX(int toX)
|
void |
setToY(int toY)
|
private char |
toLocalizedPiece(char c)
|
String |
toXEngString()
Generate a description string for WinBoard/XBoard connections |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Move NO_NEW_MOVE
private int fromX
private int fromY
private int toX
private int toY
private char promotion
private static final char[] lines
private static final char[] rows
private Position newPosition
private char piece
private boolean check
private boolean checkmate
private boolean stalemate
private boolean take
private boolean ep
private boolean longCastling
private boolean shortCastling
Constructor Detail |
---|
public Move(int fromX, int fromY, int toX, int toY)
fromX
- the original location's X coordinatefromY
- the original location's Y coordinatetoX
- the new X coordinatetoY
- the new Y coordinatepublic Move(int fromX, int fromY, int toX, int toY, char promotion)
fromX
- the original location's X coordinatefromY
- the original location's Y coordinatetoX
- the new X coordinatetoY
- the new Y coordinatepromotion
- the piece to which the pawn is promoted. ' ' will
not do any promotion. Possibilities are QqRrNnBb or a blank. Upper /lower case
is ignored.public Move(String engineMove, Position position)
engineMove
- the string sent by the engine. On WinBoard/XBoard and UCI this has the format
e2e4 etc.position
- the old position, necessary e. g. for castlingMethod Detail |
---|
public int getFromX()
public int getFromY()
public int getToX()
public int getToY()
public void setFromX(int fromX)
public void setFromY(int fromY)
public void setToX(int toX)
public void setToY(int toY)
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public Position applyMoveTo(Position pos)
pos
- the original position
public String getNotation(Position oldPosition)
private char toLocalizedPiece(char c)
public String toXEngString()
public char getPromotion()
public void setPromotion(char promotion)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |