pawn moves check
This commit is contained in:
10
Board.java
10
Board.java
@@ -9,7 +9,7 @@ public class Board {
|
||||
board[i][2] = new Pawn(i + 1, 2, "Black");
|
||||
}
|
||||
for (int i = 0; i <= 7; i++) {
|
||||
board[i][7] = new Pawn(i + 1, 7, "Black");
|
||||
board[i][7] = new Pawn(i + 1, 7, "White");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,12 @@ public class Board {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean inBounds(Position pos) {
|
||||
return (pos.x >= 0 && pos.x <= 7) && (pos.y >= 0 && pos.y <= 7);
|
||||
}
|
||||
|
||||
public boolean isOpen(Position pos) {
|
||||
return this.board[pos.x][pos.y] == null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user