From 8150181e647ed281dad74ca1149c5b2dfe12b2ad Mon Sep 17 00:00:00 2001 From: aah13002 Date: Wed, 20 Apr 2016 18:03:59 -0400 Subject: [PATCH] copy constructor for board --- src/model/Board.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/model/Board.java b/src/model/Board.java index c075539..cdb0982 100755 --- a/src/model/Board.java +++ b/src/model/Board.java @@ -27,6 +27,21 @@ public Board() { movesSinceCapture = 0; init(); } + + /** + * Copy constructor. + * @param other + */ + public Board(Board other) { + this.representation = new Piece[BOARD_SIZE][BOARD_SIZE]; + Piece[][] other_representation = other.getRepresentation(); + for (int i = 0; i < other_representation.length; ++i) { + for (int j = 0; j < other_representation[0].length; ++j) { + this.representation[i][j] = other_representation[i][j]; + } + } + movesSinceCapture = other.getMovesSinceCapture(); + } public boolean isValidSquare(int row, int col) { return 0 <= row && row < BOARD_SIZE && @@ -62,6 +77,12 @@ public boolean equals(Board other) { return true; } + public ArrayList generateMoveFrontier(Color color) { + ArrayList frontier = new ArrayList(); + + + } + /** * Generates the frontier. * @param color The color of pieces to generate the frontier for. @@ -126,6 +147,10 @@ public void setBlackPieces(ArrayList black_pieces) { public Piece[][] getRepresentation() { return this.representation; + } + + public int getMovesSinceCapture() { + return this.movesSinceCapture; } }