Merge branch 'master' of

https://gitarero.ecam.fr/yohan.montagne/OOP_2B2_Project.git
This commit is contained in:
Tilman Crosetti 2025-05-07 16:24:48 +02:00
commit 25605f5597
1 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
package backend;
import java.util.ArrayList;
import java.util.List;
import java.util.LinkedList;
public class Board {
@ -240,23 +240,23 @@ private ArrayList<int[]> highlightedPositions = new ArrayList<>();
public List<Move> getAllLegalMoves(boolean isWhite) {
List<Move> moves = new ArrayList<>();
public LinkedList<Move> getAllLegalMoves(boolean isWhite) {
LinkedList<Move> moves = new LinkedList<>();
for (int row = 0; row < 8; row++) {
for (int col = 0; col < 8; col++) {
Piece piece = getPieceAt(row, col);
if (piece != null && piece.isWhite() == isWhite) {
List<Move> pieceMoves = piece.getLegalMoves(this, row, col); // This method must exist in Piece
moves.addAll(pieceMoves);
//LinkedList<Move> pieceMoves = piece.getLegalMoves(this, row, col); // This method must exist in Piece
//moves.addAll(pieceMoves);
}
}
}
return moves;
}
public List<Piece> getAllPieces() {
List<Piece> pieces = new ArrayList<>();
public LinkedList<Piece> getAllPieces() {
LinkedList<Piece> pieces = new LinkedList<>();
for (int row = 0; row < 8; row++) {
for (int col = 0; col < 8; col++) {