Merge branch 'master' of

https://gitarero.ecam.fr/louise.berteloot/OOP_2A5_Project.git
This commit is contained in:
manon 2025-05-13 14:54:50 +02:00
parent 8689d9c8f9
commit b677a3d3d9
3 changed files with 15 additions and 7 deletions

View File

@ -34,6 +34,11 @@ public class Board {
public boolean isTurnWhite() { public boolean isTurnWhite() {
return this.isWhiteTurn; return this.isWhiteTurn;
} }
public void resetTurn() {
this.turnNumber = 0;
this.isWhiteTurn = true;
}
public void setPiece(boolean isWhite, PieceType type, int x, int y) { public void setPiece(boolean isWhite, PieceType type, int x, int y) {
Piece newPiece = new Piece(x, y, isWhite, type); Piece newPiece = new Piece(x, y, isWhite, type);
@ -394,6 +399,8 @@ public class Board {
return kingInCheck && !hasEscape; return kingInCheck && !hasEscape;
} }
/*
private void enPassant(Board board, List<Move> moves) { private void enPassant(Board board, List<Move> moves) {
int x = this.x; int x = this.x;
int y = this.y; int y = this.y;
@ -416,19 +423,22 @@ public class Board {
} }
} }
/**
* Checks if the pawn can capture another pawn by en passant * Checks if the pawn can capture another pawn by en passant
* @param pt location of the other pawn * @param pt location of the other pawn
* @return true if can be captured * @return true if can be captured
*/
private boolean isEnPassant(Board board, Point pt) { private boolean isEnPassant(Board board, Point pt) {
Piece temp = board.getPieceAt(pt); Piece temp = board.getPieceAt(pt);
if(temp != null) if(temp != null) {
if (temp instanceof Pawn && temp.getColor() != this.color) if (temp instanceof Pawn && temp.getColor() != this.color)
if (((Pawn)temp).enPassantOk) if (((Pawn)temp).enPassantOk)
return true; return true;
return false; return false;
} }
*/
} }

View File

@ -83,6 +83,7 @@ public class Game extends Thread {
public void setDefaultSetup() { public void setDefaultSetup() {
board.cleanBoard(); board.cleanBoard();
board.populateBoard(); board.populateBoard();
board.resetTurn();
} }
public void setBoard(String[] array) { public void setBoard(String[] array) {

View File

@ -27,10 +27,7 @@ public class SpecialMoves {
int[][] offsets = {{1, 2}, {-1, 2}}; int[][] offsets = {{1, 2}, {-1, 2}};
}*/ }*/
<<<<<<< HEAD
public boolean checkCoordinates(int x, int y, PieceType type, boolean isWhite) {
if (type == PieceType.Pawn && isWhite == true && y == 3) {
=======
/* public boolean checkCoordinates(int x, int y, PieceType type, boolean isWhite) { /* public boolean checkCoordinates(int x, int y, PieceType type, boolean isWhite) {
if (type == PieceType.Pawn || isWhite == true || y == 3) { if (type == PieceType.Pawn || isWhite == true || y == 3) {
>>>>>>> branch 'master' of https://gitarero.ecam.fr/louise.berteloot/OOP_2A5_Project.git >>>>>>> branch 'master' of https://gitarero.ecam.fr/louise.berteloot/OOP_2A5_Project.git