From 66b6416e6f460936a6bb11ac3e30cab9b5eadeb0 Mon Sep 17 00:00:00 2001 From: MSI Date: Tue, 6 May 2025 16:18:06 +0200 Subject: [PATCH] Board --- src/backend/Board.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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