diff --git a/src/backend/Board.java b/src/backend/Board.java index 5b9ccc7..155c1ab 100644 --- a/src/backend/Board.java +++ b/src/backend/Board.java @@ -267,10 +267,22 @@ public class Board { } - public Board(Board board) { - //TODO + public Board(Board other) { + this.cNum = other.cNum; + this.lNum = other.lNum; + this.cells = new Piece[cNum][lNum]; + this.selectedCell = null; // don't copy selection + for (int x = 0; x < cNum; x++) { + for (int y = 0; y < lNum; y++) { + Piece p = other.cells[x][y]; + if (p != null) { + this.cells[x][y] = new Piece(p.getType(), p.isWhite(), x, y); + } + } + } } + public void playMove(Move move) { //TODO