LOG320_Lab4/src/main/java/laboratoire4/Pusher.java
2023-03-21 18:06:17 -04:00

28 lines
638 B
Java

package laboratoire4;
public class Pusher extends Pawn {
public Pusher(Player player, int row, int col) {
super(player, row, col);
}
@Override
public boolean isMoveValid(Pawn[][] board, PawnMovement movement) {
Pawn to = board[row + direction][col + movement.getMove()];
if (to == null) {
return true;
}
return to.player != this.player && movement != PawnMovement.STRAIGHT;
}
@Override
public String toString() {
return "Pusher{" +
player +
", " + col +
", " + row +
"} ";
}
}