-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKing.java
23 lines (20 loc) · 960 Bytes
/
King.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class King extends Piece{
public King(int c, int y, int x){
if(c == 1){this.symbol = "♔";}
else{this.symbol = "♚";}
this.color = c;
this.currentX = x;
this.currentY = y;
}
public Piece[][] move(int y, int x, Piece[][] board, boolean ghost){
board = basicMovement(board, currentX, x, currentY, y, 1,1,ghost);
board = basicMovement(board, currentX, x, currentY, y, 1,0 ,ghost);
board = basicMovement(board, currentX, x, currentY, y, 1,-1,ghost);
board = basicMovement(board, currentX, x, currentY, y, 0, 1,ghost);
board = basicMovement(board, currentX, x, currentY, y, 0, -1,ghost);
board = basicMovement(board, currentX, x, currentY, y, -1, 1,ghost);
board = basicMovement(board, currentX, x, currentY, y, -1, 0,ghost);
board = basicMovement(board, currentX, x, currentY, y, -1, -1,ghost);
return board;
}
}