Merge pull request 'master' (#2) from master into castling-saved
Reviewed-on: #2
This commit is contained in:
commit
87fa0954fa
|
|
@ -244,9 +244,31 @@ public class Board {
|
|||
|
||||
|
||||
public Board(String[] array) {
|
||||
// TODO
|
||||
String[] gameState = array[0].split(",");
|
||||
turnNumber = Integer.parseInt(gameState[0]);
|
||||
turnWhite = gameState[1].equals("white");
|
||||
|
||||
String[] dims = array[1].split(",");
|
||||
width = Integer.parseInt(dims[0]);
|
||||
height = Integer.parseInt(dims[1]);
|
||||
|
||||
board = new Piece[width][height];
|
||||
|
||||
for (int i = 2; i < array.length; i++) {
|
||||
String[] p = array[i].split(",");
|
||||
PieceType type = PieceType.valueOf(p[0]);
|
||||
int x = Integer.parseInt(p[1]);
|
||||
int y = Integer.parseInt(p[2]);
|
||||
boolean isWhite = p[3].equals("W");
|
||||
board[x][y] = new Piece(x, y, isWhite, type);
|
||||
}
|
||||
|
||||
hasSelectedPiece = false;
|
||||
selectedX = selectedY = -1;
|
||||
highlightedSquares.clear();
|
||||
}
|
||||
|
||||
|
||||
/* The following methods require more work */
|
||||
public boolean isHighlighted(int x, int y) {
|
||||
for (int[] pos : highlightedSquares) {
|
||||
|
|
@ -316,7 +338,7 @@ public class Board {
|
|||
|
||||
|
||||
public Board(Board board) {
|
||||
// TODO helloyo
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void playMove(Move move) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue