IT WORKS !! So now we can save and load boards :)

This commit is contained in:
tothe 2025-05-06 15:10:16 +02:00
parent 16c4594e37
commit 2417b7b2ba
1 changed files with 8 additions and 6 deletions

View File

@ -228,8 +228,8 @@ public class Board {
String[] tokens = line.trim().split("\\s+");
if (tokens.length != 4) continue;
boolean isWhite = Boolean.parseBoolean(tokens[0]);
PieceType type = PieceType.valueOf(tokens[1]);
PieceType type = PieceType.valueOf(tokens[0]);
boolean isWhite = Boolean.parseBoolean(tokens[1]);
int x = Integer.parseInt(tokens[2]);
int y = Integer.parseInt(tokens[3]);
@ -237,13 +237,15 @@ public class Board {
}
}
public Board(String[] array) {
//TODO
this.cNum = 8;
this.lNum = 8;
this.cells = new Piece[cNum][lNum];
this.selectedCell = null;
loadFromFileRep(array);
}
/* The following methods require more work ! */
public boolean isHighlighted(int x, int y) {