Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public List<Coordinate> candidateMoves() {
- List<Coordinate> candidates = new ArrayList<Coordinate>();
- for (int row = 0; row < super.board.rows(); row++)
- {
- if (row == super.board.row()) continue;
- int col1 = super.column() - (super.row() - row);
- int col2 = super.column() + (super.row() - row);
- if (col1 >= 0 && col1 < super.board.cols())
- {
- candidates.add(new Coordinate(row, col1));
- }
- if (col2 >= 0 && col2 < super.board.cols())
- {
- candidates.add(new Coordinate(row, col2));
- }
- }
- return candidates;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement