Want to contribute? Fork me on Codeberg.org!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

19 lines
771 B

import java.util.ArrayList;
public class Bishop extends Piece {
public Bishop(boolean black, DrawingPanel panel) {
super(black, panel, "black-bishop.png", "white-bishop.png");
}
public ArrayList<BoardCoordinate> getPossibleMoves(BoardCoordinate position) {
ArrayList<BoardCoordinate> possibleMoves = new ArrayList<>();
for(int i = 1; i <= 7; i++) {
possibleMoves.add(new BoardCoordinate(position.x - i, position.y - i));
possibleMoves.add(new BoardCoordinate(position.x - i, position.y + i));
possibleMoves.add(new BoardCoordinate(position.x + i, position.y - i));
possibleMoves.add(new BoardCoordinate(position.x + i, position.y + i));
}
return possibleMoves;
}
}