just added isQueenMoveValid as a separate method just in case i need it
for the future, king and knight can be simplified via a helper function, working on that
This commit is contained in:
parent
1dd328c408
commit
87aaad73e0
|
|
@ -252,7 +252,7 @@ public class Board {
|
|||
isAPieceHere = move.isRookMoveValid(x, y, color, selectX, selectY);
|
||||
|
||||
} else if (type == PieceType.Queen) {
|
||||
isAPieceHere = (move.isBishopMoveValid(x, y, color, selectX, selectY) || move.isRookMoveValid(x, y, color, selectX, selectY)); // a queen is a Bishop and a rook, the move of both with an "Or" does the job !
|
||||
isAPieceHere = move.isQueenMoveValid(x, y, color, selectX, selectY);
|
||||
|
||||
} else if (type == PieceType.Knight) {
|
||||
isAPieceHere = move.isKnightMoveValid(x, y, color, selectX, selectY);
|
||||
|
|
|
|||
|
|
@ -225,6 +225,10 @@ public class Move {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isQueenMoveValid(int x, int y, boolean color, int selectX, int selectY) {
|
||||
return isBishopMoveValid(x, y, color, selectX, selectY) || isRookMoveValid(x, y, color, selectX, selectY); // a queen is a Bishop and a rook, the move of both with an "Or" does the job !;
|
||||
}
|
||||
|
||||
public boolean isKnightMoveValid(int x, int y, boolean color, int selectX, int selectY) {
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue