package li.seiji.minichess.figure;

import li.seiji.minichess.Move;
import li.seiji.minichess.State;

public class Rook implements IFigure {

    public static final char identifier = 'r';

    static boolean isMoveValid(State state, Move move) {
        if(!IFigure.isMoveValid(state, move)) return false;

        return (IFigure.getAbsMoveDeltaX(move) == 2 && IFigure.getAbsMoveDeltaY(move) == 1) ||
                (IFigure.getAbsMoveDeltaX(move) == 1 && IFigure.getAbsMoveDeltaY(move) == 2);
    }

}

@@ -87,21 +87,92 @@
 nichess.
-State
+Player;%0Aimport li.seiji.minichess.State;%0A%0Aimport java.util.function.Function
 ;%0A%0Apubli
@@ -380,23 +380,18 @@
         
-return 
+if
 (IFigure
@@ -395,178 +395,344 @@
 ure.
-getAbsMoveDeltaX(move) == 2 && IFigure.getAbsMoveDeltaY(move) == 1) %7C%7C%0A                (IFigure.getAbsMoveDeltaX(move) == 1 && IFigure.getAbsMoveDeltaY(move) == 2);%0A    %7D
+isStraightMove(move))%0A            if(!IFigure.checkStraightIsBlocked(state, move, straightBlockChecker))%0A                return true;%0A%0A        return false;%0A    %7D%0A%0A    //Rook is blocked by any figure that is not an empty field%0A    private static Function%3CPlayer, Boolean%3E straightBlockChecker = (Player player) -%3E player != Player.NONE;
 %0A%0A%7D%0A

Implement Rook isValidMove check