Fixed knight move validation, renamed test
This commit is contained in:
parent
c7bac23420
commit
0c59c7e540
@ -17,7 +17,8 @@ public class Knight extends Piece {
|
||||
|
||||
@Override
|
||||
public boolean isValidMove(Move move) {
|
||||
return Math.abs(move.xDist - move.yDist) == 1 && (move.xDist == 1 || move.yDist == 1) && isFreePath(move);
|
||||
return Math.abs(move.xDist - move.yDist) == 1
|
||||
&& (move.xDist == 1 && move.yDist == 2 || move.xDist == 2 && move.yDist == 1) && checkDestination(move);
|
||||
}
|
||||
|
||||
private void checkAndInsertMove(List<Move> moves, Position pos, int offsetX, int offsetY) {
|
||||
|
@ -12,11 +12,11 @@ import dev.kske.chess.board.Queen;
|
||||
|
||||
/**
|
||||
* Project: <strong>Chess</strong><br>
|
||||
* File: <strong>BoardCloneTest.java</strong><br>
|
||||
* File: <strong>BoardTest.java</strong><br>
|
||||
* Created: <strong>08.07.2019</strong><br>
|
||||
* Author: <strong>Kai S. K. Engelbart</strong>
|
||||
*/
|
||||
class BoardCloneTest {
|
||||
class BoardTest {
|
||||
|
||||
Board board;
|
||||
|
||||
@ -40,5 +40,4 @@ class BoardCloneTest {
|
||||
clone.getBoardArr()[0][0] = new Queen(Color.BLACK, clone);
|
||||
assertNotEquals(clone.getBoardArr()[0][0], board.getBoardArr()[0][0]);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user