Compare commits
2 commits
45f7544151
...
b5dc5a4228
Author | SHA1 | Date | |
---|---|---|---|
|
b5dc5a4228 | ||
|
6f51247019 |
1 changed files with 9 additions and 2 deletions
|
@ -5,10 +5,17 @@ public class Knight extends Piece {
|
||||||
super(black);
|
super(black);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArrayList<BoardCoordinate> getPossibleMoves(BoardCoordinate position) {
|
public ArrayList<BoardCoordinate> getPossibleMoves(BoardCoordinate position) {
|
||||||
ArrayList<BoardCoordinate> possibleMoves = new ArrayList<>();
|
ArrayList<BoardCoordinate> possibleMoves = new ArrayList<>();
|
||||||
possibleMoves.add(new BoardCoordinate(position.x, position.y - 1)); // to up
|
possibleMoves.add(new BoardCoordinate(position.x - 2, position.y - 1));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x - 1, position.y - 2));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x + 1, position.y - 2));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x + 2, position.y - 1));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x + 2, position.y + 1));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x + 1, position.y + 2));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x - 1, position.y + 2));
|
||||||
|
possibleMoves.add(new BoardCoordinate(position.x - 2, position.y + 1));
|
||||||
|
// test
|
||||||
return possibleMoves;
|
return possibleMoves;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue