king, copy board logic, getPseudoMoves

This commit is contained in:
CT
2026-04-24 13:34:00 -05:00
parent 984c37a833
commit c3318f834c
16 changed files with 185 additions and 120 deletions

View File

@@ -13,6 +13,10 @@ public class Board {
}
}
public Board(boolean isCopy) {
board = new Piece[8][8];
}
public void draw(Graphics g) {
for (Piece[] row : board) {
for (Piece p : row) {
@@ -32,4 +36,22 @@ public class Board {
public Piece getPiece(Position pos) {
return this.board[pos.x][pos.y];
}
public Piece getPiece(int x, int y) {
return this.board[x][y];
}
public static Board copy(Board b) {
Board newBoard = new Board();
for (int i = 0; i <= 7; i++) {
for (int j = 0; j <= 7; j++) {
Piece p = b.getPiece(i, j);
if (p == null) continue;
newBoard.board[i][j] = p.copy();
}
}
return newBoard;
}
}