From b677a3d3d938028795ff01b3788ef72044bc4abb Mon Sep 17 00:00:00 2001 From: manon Date: Tue, 13 May 2025 14:54:50 +0200 Subject: [PATCH] Merge branch 'master' of https://gitarero.ecam.fr/louise.berteloot/OOP_2A5_Project.git --- src/backend/Board.java | 16 +++++++++++++--- src/backend/Game.java | 1 + src/backend/SpecialMoves.java | 5 +---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/backend/Board.java b/src/backend/Board.java index 12dac32..9bda6b4 100644 --- a/src/backend/Board.java +++ b/src/backend/Board.java @@ -34,6 +34,11 @@ public class Board { public boolean isTurnWhite() { return this.isWhiteTurn; } + + public void resetTurn() { + this.turnNumber = 0; + this.isWhiteTurn = true; + } public void setPiece(boolean isWhite, PieceType type, int x, int y) { Piece newPiece = new Piece(x, y, isWhite, type); @@ -394,6 +399,8 @@ public class Board { return kingInCheck && !hasEscape; } + + /* private void enPassant(Board board, List moves) { int x = this.x; int y = this.y; @@ -416,19 +423,22 @@ public class Board { } } - /** + * Checks if the pawn can capture another pawn by en passant * @param pt location of the other pawn * @return true if can be captured - */ + + private boolean isEnPassant(Board board, Point pt) { Piece temp = board.getPieceAt(pt); - if(temp != null) + if(temp != null) { if (temp instanceof Pawn && temp.getColor() != this.color) if (((Pawn)temp).enPassantOk) return true; return false; } + */ + } diff --git a/src/backend/Game.java b/src/backend/Game.java index 51d0356..7ab9929 100644 --- a/src/backend/Game.java +++ b/src/backend/Game.java @@ -83,6 +83,7 @@ public class Game extends Thread { public void setDefaultSetup() { board.cleanBoard(); board.populateBoard(); + board.resetTurn(); } public void setBoard(String[] array) { diff --git a/src/backend/SpecialMoves.java b/src/backend/SpecialMoves.java index 71719ef..3ce85ee 100644 --- a/src/backend/SpecialMoves.java +++ b/src/backend/SpecialMoves.java @@ -27,10 +27,7 @@ public class SpecialMoves { 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) { if (type == PieceType.Pawn || isWhite == true || y == 3) { >>>>>>> branch 'master' of https://gitarero.ecam.fr/louise.berteloot/OOP_2A5_Project.git