pawn moves check

This commit is contained in:
CT
2026-04-23 13:10:37 -05:00
parent 7f9cdfea63
commit 677eae9119
9 changed files with 85 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ public class Board {
board[i][2] = new Pawn(i + 1, 2, "Black");
}
for (int i = 0; i <= 7; i++) {
board[i][7] = new Pawn(i + 1, 7, "Black");
board[i][7] = new Pawn(i + 1, 7, "White");
}
}
@@ -20,4 +20,12 @@ public class Board {
}
}
}
public static boolean inBounds(Position pos) {
return (pos.x >= 0 && pos.x <= 7) && (pos.y >= 0 && pos.y <= 7);
}
public boolean isOpen(Position pos) {
return this.board[pos.x][pos.y] == null;
}
}