This repository has been archived on 2023-03-16. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Chess/src/Bishop.java

22 lines
No EOL
736 B
Java

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 int getValue() {
return 3;
}
public ArrayList<Move> getPossibleMoves(BoardCoordinate position, Board board) {
ArrayList<Move> possibleMoves = new ArrayList<>();
getPossibleMovesInDirection(1, 1, position, board, possibleMoves);
getPossibleMovesInDirection(-1, -1, position, board, possibleMoves);
getPossibleMovesInDirection(1, -1, position, board, possibleMoves);
getPossibleMovesInDirection(-1, 1, position, board, possibleMoves);
return possibleMoves;
}
}