diff --git a/src/model/Board.java b/src/model/Board.java index 721936e..29a12af 100755 --- a/src/model/Board.java +++ b/src/model/Board.java @@ -23,6 +23,22 @@ public Board() { representation = new Piece[BOARD_SIZE][BOARD_SIZE]; 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(Location location) { @@ -59,6 +75,25 @@ 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. + * @return A list of possible "next moves" in the form of boards. + */ + public ArrayList generateFrontier(Color color) { + ArrayList from_jumps = generateJumpFrontier(color); + if(from_jumps.isEmpty()) { + return generateMoveFrontier(color); + } + return from_jumps; + } + /** * Print the current board representation */ @@ -104,6 +139,10 @@ public boolean isOccupied(Location location) { public Piece[][] getRepresentation() { return this.representation; + } + + public int getMovesSinceCapture() { + return this.movesSinceCapture; } }