This repository has been archived on 2023-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
Chess/src/Rook.java
JoffreTS 17b506922a updating movement
updating movement
2023-03-13 17:28:10 -07:00

19 lines
No EOL
696 B
Java

import java.util.ArrayList;
public class Rook extends Piece {
public Rook(boolean black, DrawingPanel panel) {
super(black, panel, "black-rook.png", "white-rook.png");
}
public ArrayList<BoardCoordinate> getPossibleMoves(BoardCoordinate position, Board board) {
ArrayList<BoardCoordinate> possibleMoves = new ArrayList<>();
getPossibleMovesInDirection(0, 1, position, board, possibleMoves);
getPossibleMovesInDirection(0, -1, position, board, possibleMoves);
getPossibleMovesInDirection(1, 0, position, board, possibleMoves);
getPossibleMovesInDirection(-1, 0, position, board, possibleMoves);
return possibleMoves;
}
}