Corrected the pawn logic as it was flawed.

This commit is contained in:
yohanmontagne 2025-05-15 16:16:31 +02:00
parent 73e0bc0106
commit c363bf7c1b
1 changed files with 2 additions and 2 deletions

View File

@ -12,8 +12,8 @@ public class Pawn extends Piece {
@Override
public List<Move> getLegalMoves(Board board, int row, int col) {
List<Move> moves = new ArrayList<>();
int direction = isWhite ? -1 : 1; // White moves up, black down
int startRow = isWhite ? 6 : 1;
int direction = isWhite ? 1 : -1; // White moves up, black down
int startRow = isWhite ? 1 : 6;
// Move forward
int oneStep = row + direction;