Skip to content

Commit

Permalink
generateJumpFrontier implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron committed Apr 21, 2016
1 parent 15701da commit c7d42f0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/model/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public boolean equals(Board other) {
}

/**
* Generates the frontier for a particular piece.
* Generates the Move set for a particular piece.
* @param p
* @return
*/
Expand Down Expand Up @@ -198,6 +198,24 @@ public ArrayList<Move> generateJumpMoves(Piece p) {
return jumps;
}

public ArrayList<Board> generateJumpFrontier(Color color) {
ArrayList<Board> frontier = new ArrayList<Board>();
for (int i = 0; i < BOARD_SIZE; ++i) {
for (int j = 0; j < BOARD_SIZE; ++j) {
Piece p = this.representation[i][j];
if (null != p && p.getColor() == color) {
ArrayList<Move> jump_moves = generateMoves(this.representation[i][j]);
for (Move jump : jump_moves) {
Board board = new Board(this);
board.move(jump);
frontier.add(board);
}
}
}
}
return frontier;
}

/**
* Generates the frontier.
* @param color The color of pieces to generate the frontier for.
Expand Down

0 comments on commit c7d42f0

Please sign in to comment.