Roque + qlq corrections syntaxe
This commit is contained in:
parent
cdbba67bc5
commit
014faea8ca
|
|
@ -18,7 +18,6 @@ public class Board {
|
||||||
|
|
||||||
private Stack<Move> moveHistory = new Stack<>();
|
private Stack<Move> moveHistory = new Stack<>();
|
||||||
|
|
||||||
// EN PASSANT
|
|
||||||
private Integer enPassantX = null;
|
private Integer enPassantX = null;
|
||||||
private Integer enPassantY = null;
|
private Integer enPassantY = null;
|
||||||
|
|
||||||
|
|
@ -76,6 +75,10 @@ public class Board {
|
||||||
public Integer getEnPassantX() { return enPassantX; }
|
public Integer getEnPassantX() { return enPassantX; }
|
||||||
public Integer getEnPassantY() { return enPassantY; }
|
public Integer getEnPassantY() { return enPassantY; }
|
||||||
|
|
||||||
|
public void setGameOver(boolean gameOver) {
|
||||||
|
this.gameOver = gameOver;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPiece(boolean isWhite, PieceType type, int x, int y) {
|
public void setPiece(boolean isWhite, PieceType type, int x, int y) {
|
||||||
pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
||||||
pieces.add(new Piece(isWhite, type, x, y));
|
pieces.add(new Piece(isWhite, type, x, y));
|
||||||
|
|
@ -119,16 +122,11 @@ public class Board {
|
||||||
|
|
||||||
public ArrayList<Piece> getPieces() { return pieces; }
|
public ArrayList<Piece> getPieces() { return pieces; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Gère la sélection et le déplacement d'une pièce par l'utilisateur.
|
|
||||||
* Empêche la capture du roi et termine la partie sur échec et mat.
|
|
||||||
*/
|
|
||||||
public void userTouch(int x, int y) {
|
public void userTouch(int x, int y) {
|
||||||
if (gameOver) return;
|
if (gameOver) return;
|
||||||
|
|
||||||
Piece clickedPiece = getPieceAt(x, y);
|
Piece clickedPiece = getPieceAt(x, y);
|
||||||
|
|
||||||
// Sélection initiale
|
|
||||||
if (selectedX == null || selectedY == null) {
|
if (selectedX == null || selectedY == null) {
|
||||||
if (clickedPiece != null && clickedPiece.isWhite() == turnIsWhite) {
|
if (clickedPiece != null && clickedPiece.isWhite() == turnIsWhite) {
|
||||||
selectedX = x;
|
selectedX = x;
|
||||||
|
|
@ -138,7 +136,6 @@ public class Board {
|
||||||
} else {
|
} else {
|
||||||
Piece selectedPiece = getPieceAt(selectedX, selectedY);
|
Piece selectedPiece = getPieceAt(selectedX, selectedY);
|
||||||
if (selectedPiece != null && selectedPiece.isWhite() == turnIsWhite) {
|
if (selectedPiece != null && selectedPiece.isWhite() == turnIsWhite) {
|
||||||
// Simuler le mouvement pour vérifier l'absence d'échec
|
|
||||||
Board simulation = new Board(this);
|
Board simulation = new Board(this);
|
||||||
simulation.pieces.removeIf(p -> p.getX() == selectedX && p.getY() == selectedY);
|
simulation.pieces.removeIf(p -> p.getX() == selectedX && p.getY() == selectedY);
|
||||||
simulation.pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
simulation.pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
||||||
|
|
@ -151,32 +148,55 @@ public class Board {
|
||||||
if (!simulation.isKingInCheck(turnIsWhite)) {
|
if (!simulation.isKingInCheck(turnIsWhite)) {
|
||||||
Piece target = getPieceAt(x, y);
|
Piece target = getPieceAt(x, y);
|
||||||
|
|
||||||
// EN PASSANT (avant la capture normale)
|
|
||||||
boolean enPassantMove = false;
|
boolean enPassantMove = false;
|
||||||
if (selectedPiece.getType() == PieceType.Pawn
|
if (selectedPiece.getType() == PieceType.Pawn
|
||||||
&& getEnPassantX() != null && getEnPassantY() != null
|
&& getEnPassantX() != null && getEnPassantY() != null
|
||||||
&& x == getEnPassantX() && y == getEnPassantY()
|
&& x == getEnPassantX() && y == getEnPassantY()
|
||||||
&& target == null
|
&& target == null
|
||||||
&& selectedX != x) {
|
&& selectedX != x) {
|
||||||
// On va prendre en passant
|
|
||||||
enPassantMove = true;
|
enPassantMove = true;
|
||||||
int capturedY = turnIsWhite ? y + 1 : y - 1;
|
int capturedY = turnIsWhite ? y + 1 : y - 1;
|
||||||
pieces.removeIf(p -> p.getX() == x && p.getY() == capturedY);
|
pieces.removeIf(p -> p.getX() == x && p.getY() == capturedY);
|
||||||
target = getPieceAt(x, capturedY); // Pour le move history
|
target = getPieceAt(x, capturedY);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean castlingMove = false;
|
||||||
|
if (selectedPiece.getType() == PieceType.King) {
|
||||||
|
// Petit roque blanc
|
||||||
|
if (selectedPiece.isWhite() && selectedX == 4 && selectedY == 7 && x == 6 && y == 7) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 7 && p.getY() == 7);
|
||||||
|
pieces.add(new Piece(true, PieceType.Rook, 5, 7));
|
||||||
|
castlingMove = true;
|
||||||
|
}
|
||||||
|
// Grand roque blanc
|
||||||
|
if (selectedPiece.isWhite() && selectedX == 4 && selectedY == 7 && x == 2 && y == 7) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 0 && p.getY() == 7);
|
||||||
|
pieces.add(new Piece(true, PieceType.Rook, 3, 7));
|
||||||
|
castlingMove = true;
|
||||||
|
}
|
||||||
|
// Petit roque noir
|
||||||
|
if (!selectedPiece.isWhite() && selectedX == 4 && selectedY == 0 && x == 6 && y == 0) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 7 && p.getY() == 0);
|
||||||
|
pieces.add(new Piece(false, PieceType.Rook, 5, 0));
|
||||||
|
castlingMove = true;
|
||||||
|
}
|
||||||
|
// Grand roque noir
|
||||||
|
if (!selectedPiece.isWhite() && selectedX == 4 && selectedY == 0 && x == 2 && y == 0) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 0 && p.getY() == 0);
|
||||||
|
pieces.add(new Piece(false, PieceType.Rook, 3, 0));
|
||||||
|
castlingMove = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si on cible le roi adverse, c'est un cas de mat -> terminer la partie
|
|
||||||
if (target != null && target.getType() == PieceType.King) {
|
if (target != null && target.getType() == PieceType.King) {
|
||||||
gameOver = true;
|
gameOver = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture normale
|
|
||||||
if (!enPassantMove && target != null) {
|
if (!enPassantMove && target != null) {
|
||||||
pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Déplacer la pièce sélectionnée
|
|
||||||
pieces.removeIf(p -> p.getX() == selectedX && p.getY() == selectedY);
|
pieces.removeIf(p -> p.getX() == selectedX && p.getY() == selectedY);
|
||||||
pieces.add(new Piece(
|
pieces.add(new Piece(
|
||||||
selectedPiece.isWhite(),
|
selectedPiece.isWhite(),
|
||||||
|
|
@ -184,31 +204,27 @@ public class Board {
|
||||||
x, y
|
x, y
|
||||||
));
|
));
|
||||||
|
|
||||||
// EN PASSANT : Maj de la case en passant
|
|
||||||
if (selectedPiece.getType() == PieceType.Pawn && Math.abs(y - selectedY) == 2) {
|
if (selectedPiece.getType() == PieceType.Pawn && Math.abs(y - selectedY) == 2) {
|
||||||
enPassantX = x;
|
enPassantX = x;
|
||||||
enPassantY = (y + selectedY) / 2; // Case traversée
|
enPassantY = (y + selectedY) / 2;
|
||||||
} else {
|
} else {
|
||||||
enPassantX = null;
|
enPassantX = null;
|
||||||
enPassantY = null;
|
enPassantY = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move history (on précise enPassant ou non)
|
|
||||||
Move move = new Move(selectedPiece, selectedX, selectedY, x, y, target,
|
Move move = new Move(selectedPiece, selectedX, selectedY, x, y, target,
|
||||||
enPassantMove);
|
enPassantMove, castlingMove);
|
||||||
moveHistory.push(move);
|
moveHistory.push(move);
|
||||||
|
|
||||||
// Changer de tour
|
|
||||||
turnNumber++;
|
turnNumber++;
|
||||||
turnIsWhite = !turnIsWhite;
|
turnIsWhite = !turnIsWhite;
|
||||||
|
|
||||||
// Vérifier échec et mat sur le prochain joueur
|
|
||||||
if (isCheckmate(turnIsWhite)) {
|
if (isCheckmate(turnIsWhite)) {
|
||||||
gameOver = true;
|
gameOver = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Réinitialiser la sélection
|
|
||||||
selectedX = null;
|
selectedX = null;
|
||||||
selectedY = null;
|
selectedY = null;
|
||||||
highlightedPositions.clear();
|
highlightedPositions.clear();
|
||||||
|
|
@ -267,7 +283,7 @@ public class Board {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (king == null) return true; // pas de roi => considérer comme échec
|
if (king == null) return true;
|
||||||
for (Piece enemy : pieces) {
|
for (Piece enemy : pieces) {
|
||||||
if (enemy.isWhite() != isWhite) {
|
if (enemy.isWhite() != isWhite) {
|
||||||
ArrayList<int[]> moves = getLegalMovesFor(enemy);
|
ArrayList<int[]> moves = getLegalMovesFor(enemy);
|
||||||
|
|
@ -314,12 +330,10 @@ public class Board {
|
||||||
moves.add(new int[]{x, twoStepY});
|
moves.add(new int[]{x, twoStepY});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Capture à gauche
|
|
||||||
if (inBounds(x - 1, oneStepY)) {
|
if (inBounds(x - 1, oneStepY)) {
|
||||||
Piece left = getPieceAt(x - 1, oneStepY);
|
Piece left = getPieceAt(x - 1, oneStepY);
|
||||||
if (left != null && left.isWhite() != isWhite)
|
if (left != null && left.isWhite() != isWhite)
|
||||||
moves.add(new int[]{x - 1, oneStepY});
|
moves.add(new int[]{x - 1, oneStepY});
|
||||||
// EN PASSANT GAUCHE
|
|
||||||
if (getEnPassantX() != null && getEnPassantY() != null &&
|
if (getEnPassantX() != null && getEnPassantY() != null &&
|
||||||
x - 1 == getEnPassantX() && oneStepY == getEnPassantY() &&
|
x - 1 == getEnPassantX() && oneStepY == getEnPassantY() &&
|
||||||
getPieceAt(x - 1, y) != null &&
|
getPieceAt(x - 1, y) != null &&
|
||||||
|
|
@ -328,12 +342,10 @@ public class Board {
|
||||||
moves.add(new int[]{x - 1, oneStepY});
|
moves.add(new int[]{x - 1, oneStepY});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Capture à droite
|
|
||||||
if (inBounds(x + 1, oneStepY)) {
|
if (inBounds(x + 1, oneStepY)) {
|
||||||
Piece right = getPieceAt(x + 1, oneStepY);
|
Piece right = getPieceAt(x + 1, oneStepY);
|
||||||
if (right != null && right.isWhite() != isWhite)
|
if (right != null && right.isWhite() != isWhite)
|
||||||
moves.add(new int[]{x + 1, oneStepY});
|
moves.add(new int[]{x + 1, oneStepY});
|
||||||
// EN PASSANT DROITE
|
|
||||||
if (getEnPassantX() != null && getEnPassantY() != null &&
|
if (getEnPassantX() != null && getEnPassantY() != null &&
|
||||||
x + 1 == getEnPassantX() && oneStepY == getEnPassantY() &&
|
x + 1 == getEnPassantX() && oneStepY == getEnPassantY() &&
|
||||||
getPieceAt(x + 1, y) != null &&
|
getPieceAt(x + 1, y) != null &&
|
||||||
|
|
@ -452,29 +464,45 @@ public class Board {
|
||||||
for (String line : toFileRep()) System.out.println(line);
|
for (String line : toFileRep()) System.out.println(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Appliquer un coup déjà construit.
|
|
||||||
* Bloque la capture du roi et termine la partie sur échec et mat.
|
|
||||||
*/
|
|
||||||
public void playMove(Move move) {
|
public void playMove(Move move) {
|
||||||
if (move == null || gameOver) return;
|
if (move == null || gameOver) return;
|
||||||
Piece captured = getPieceAt(move.getToX(), move.getToY());
|
Piece captured = getPieceAt(move.getToX(), move.getToY());
|
||||||
// EN PASSANT (avant la capture normale)
|
|
||||||
if (move.getMovedPiece().getType() == PieceType.Pawn
|
if (move.getMovedPiece().getType() == PieceType.Pawn
|
||||||
&& move.isEnPassant()) {
|
&& move.isEnPassant()) {
|
||||||
int capturedY = move.getMovedPiece().isWhite() ? move.getToY() + 1 : move.getToY() - 1;
|
int capturedY = move.getMovedPiece().isWhite() ? move.getToY() + 1 : move.getToY() - 1;
|
||||||
pieces.removeIf(p -> p.getX() == move.getToX() && p.getY() == capturedY);
|
pieces.removeIf(p -> p.getX() == move.getToX() && p.getY() == capturedY);
|
||||||
}
|
}
|
||||||
// Si tentative de capturer le roi, fin de partie
|
|
||||||
if (captured != null && captured.getType() == PieceType.King) {
|
if (captured != null && captured.getType() == PieceType.King) {
|
||||||
gameOver = true;
|
gameOver = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Capture normale
|
|
||||||
if (!(move.getMovedPiece().getType() == PieceType.Pawn && move.isEnPassant()) && captured != null) {
|
if (!(move.getMovedPiece().getType() == PieceType.Pawn && move.isEnPassant()) && captured != null) {
|
||||||
pieces.removeIf(p -> p.getX() == move.getToX() && p.getY() == move.getToY());
|
pieces.removeIf(p -> p.getX() == move.getToX() && p.getY() == move.getToY());
|
||||||
}
|
}
|
||||||
// Déplacement
|
|
||||||
|
// Roque (déplacement de la tour)
|
||||||
|
if (move.getMovedPiece().getType() == PieceType.King && move.isCastling()) {
|
||||||
|
if (move.getMovedPiece().isWhite() && move.getFromX() == 4 && move.getFromY() == 7 && move.getToX() == 6 && move.getToY() == 7) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 7 && p.getY() == 7);
|
||||||
|
pieces.add(new Piece(true, PieceType.Rook, 5, 7));
|
||||||
|
}
|
||||||
|
if (move.getMovedPiece().isWhite() && move.getFromX() == 4 && move.getFromY() == 7 && move.getToX() == 2 && move.getToY() == 7) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 0 && p.getY() == 7);
|
||||||
|
pieces.add(new Piece(true, PieceType.Rook, 3, 7));
|
||||||
|
}
|
||||||
|
if (!move.getMovedPiece().isWhite() && move.getFromX() == 4 && move.getFromY() == 0 && move.getToX() == 6 && move.getToY() == 0) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 7 && p.getY() == 0);
|
||||||
|
pieces.add(new Piece(false, PieceType.Rook, 5, 0));
|
||||||
|
}
|
||||||
|
if (!move.getMovedPiece().isWhite() && move.getFromX() == 4 && move.getFromY() == 0 && move.getToX() == 2 && move.getToY() == 0) {
|
||||||
|
pieces.removeIf(p -> p.getX() == 0 && p.getY() == 0);
|
||||||
|
pieces.add(new Piece(false, PieceType.Rook, 3, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pieces.removeIf(p -> p.getX() == move.getFromX() && p.getY() == move.getFromY());
|
pieces.removeIf(p -> p.getX() == move.getFromX() && p.getY() == move.getFromY());
|
||||||
pieces.add(new Piece(
|
pieces.add(new Piece(
|
||||||
move.getMovedPiece().isWhite(),
|
move.getMovedPiece().isWhite(),
|
||||||
|
|
@ -482,7 +510,6 @@ public class Board {
|
||||||
move.getToX(), move.getToY()
|
move.getToX(), move.getToY()
|
||||||
));
|
));
|
||||||
|
|
||||||
// EN PASSANT : Maj de la case en passant
|
|
||||||
if (move.getMovedPiece().getType() == PieceType.Pawn && Math.abs(move.getToY() - move.getFromY()) == 2) {
|
if (move.getMovedPiece().getType() == PieceType.Pawn && Math.abs(move.getToY() - move.getFromY()) == 2) {
|
||||||
enPassantX = move.getToX();
|
enPassantX = move.getToX();
|
||||||
enPassantY = (move.getToY() + move.getFromY()) / 2;
|
enPassantY = (move.getToY() + move.getFromY()) / 2;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class Game extends Thread {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(loopDelay);
|
Thread.sleep(loopDelay);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// Thread interrupted -> fin de la boucle de jeu
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -61,11 +61,11 @@ public class Game extends Thread {
|
||||||
private void checkForCheckmate() {
|
private void checkForCheckmate() {
|
||||||
boolean nextIsWhite = board.isTurnWhite();
|
boolean nextIsWhite = board.isTurnWhite();
|
||||||
if (board.isCheckmate(nextIsWhite)) {
|
if (board.isCheckmate(nextIsWhite)) {
|
||||||
// 1) on fixe le flag gameOver dans Board
|
|
||||||
board.setGameOver(true);
|
board.setGameOver(true);
|
||||||
// 2) on force l'UI à se repaint
|
|
||||||
mjf.update(board.getTurnNumber(), board.isTurnWhite());
|
mjf.update(board.getTurnNumber(), board.isTurnWhite());
|
||||||
// 3) on quitte la boucle run()
|
|
||||||
this.interrupt();
|
this.interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +78,6 @@ public class Game extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickCoords(int x, int y) {
|
public void clickCoords(int x, int y) {
|
||||||
// bornes ajustées : 0 <= x < width, 0 <= y < height
|
|
||||||
if (x < 0 || y < 0 || x >= getWidth() || y >= getHeight()) {
|
if (x < 0 || y < 0 || x >= getWidth() || y >= getHeight()) {
|
||||||
System.out.println("Click out of bounds");
|
System.out.println("Click out of bounds");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ public class Move {
|
||||||
private int toX, toY;
|
private int toX, toY;
|
||||||
private Piece capturedPiece;
|
private Piece capturedPiece;
|
||||||
|
|
||||||
|
// Pour coups spéciaux
|
||||||
private boolean isEnPassant = false;
|
private boolean isEnPassant = false;
|
||||||
|
private boolean isCastling = false;
|
||||||
|
|
||||||
|
// Constructeur normal
|
||||||
public Move(Piece movedPiece, int fromX, int fromY, int toX, int toY, Piece capturedPiece) {
|
public Move(Piece movedPiece, int fromX, int fromY, int toX, int toY, Piece capturedPiece) {
|
||||||
this.movedPiece = movedPiece;
|
this.movedPiece = movedPiece;
|
||||||
this.fromX = fromX;
|
this.fromX = fromX;
|
||||||
|
|
@ -18,7 +20,24 @@ public class Move {
|
||||||
this.capturedPiece = capturedPiece;
|
this.capturedPiece = capturedPiece;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Move(Piece movedPiece, int fromX, int fromY, int toX, int toY, Piece capturedPiece, boolean isEnPassant) {
|
// Constructeur pour en passant OU roque
|
||||||
|
public Move(Piece movedPiece, int fromX, int fromY, int toX, int toY, Piece capturedPiece, boolean isEnPassantOrCastling) {
|
||||||
|
this.movedPiece = movedPiece;
|
||||||
|
this.fromX = fromX;
|
||||||
|
this.fromY = fromY;
|
||||||
|
this.toX = toX;
|
||||||
|
this.toY = toY;
|
||||||
|
this.capturedPiece = capturedPiece;
|
||||||
|
// Heuristique simple : si c'est un pion, c'est "en passant", sinon c'est un roque
|
||||||
|
if (movedPiece.getType() == PieceType.Pawn) {
|
||||||
|
this.isEnPassant = isEnPassantOrCastling;
|
||||||
|
} else if (movedPiece.getType() == PieceType.King) {
|
||||||
|
this.isCastling = isEnPassantOrCastling;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructeur complet, si besoin de tout préciser
|
||||||
|
public Move(Piece movedPiece, int fromX, int fromY, int toX, int toY, Piece capturedPiece, boolean isEnPassant, boolean isCastling) {
|
||||||
this.movedPiece = movedPiece;
|
this.movedPiece = movedPiece;
|
||||||
this.fromX = fromX;
|
this.fromX = fromX;
|
||||||
this.fromY = fromY;
|
this.fromY = fromY;
|
||||||
|
|
@ -26,38 +45,21 @@ public class Move {
|
||||||
this.toY = toY;
|
this.toY = toY;
|
||||||
this.capturedPiece = capturedPiece;
|
this.capturedPiece = capturedPiece;
|
||||||
this.isEnPassant = isEnPassant;
|
this.isEnPassant = isEnPassant;
|
||||||
|
this.isCastling = isCastling;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Piece getMovedPiece() {
|
public Piece getMovedPiece() { return movedPiece; }
|
||||||
return movedPiece;
|
public int getFromX() { return fromX; }
|
||||||
}
|
public int getFromY() { return fromY; }
|
||||||
|
public int getToX() { return toX; }
|
||||||
|
public int getToY() { return toY; }
|
||||||
|
public Piece getCapturedPiece() { return capturedPiece; }
|
||||||
|
|
||||||
public int getFromX() {
|
// Pour en passant
|
||||||
return fromX;
|
public boolean isEnPassant() { return isEnPassant; }
|
||||||
}
|
public void setEnPassant(boolean enPassant) { this.isEnPassant = enPassant; }
|
||||||
|
|
||||||
public int getFromY() {
|
// Pour roque
|
||||||
return fromY;
|
public boolean isCastling() { return isCastling; }
|
||||||
}
|
public void setCastling(boolean castling) { this.isCastling = castling; }
|
||||||
|
|
||||||
public int getToX() {
|
|
||||||
return toX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getToY() {
|
|
||||||
return toY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Piece getCapturedPiece() {
|
|
||||||
return capturedPiece;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isEnPassant() {
|
|
||||||
return isEnPassant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnPassant(boolean enPassant) {
|
|
||||||
this.isEnPassant = enPassant;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue