Skip to content

Commit

Permalink
makes jump moves required when available
Browse files Browse the repository at this point in the history
  • Loading branch information
lbvx committed Jan 22, 2025
1 parent cd0b551 commit 03a4ed5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/puzzle/JackBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ public List<Move> getPossibleMoves(int playerColorPiece)
while (captures.size() < moves.size()) {
captures.add(new ArrayList<Position>());
}
for(int j = 0; j<moves.size(); j++) {
for(int j = 0; j<moves.size(); j++) {
ret.add(new Move( new Position(x, y),moves.get(j), captures.get(j)));
}
}
}
}

if (ret.stream().anyMatch(Move::isJumpMove))
{
ret.removeIf(move -> !move.isJumpMove());
}

return ret;
}

Expand Down

0 comments on commit 03a4ed5

Please sign in to comment.