turn number doesn't work after loading file

This commit is contained in:
Lucie 2025-05-19 17:50:40 +02:00
parent e5cddf031b
commit 87f6595e52
1 changed files with 5 additions and 1 deletions

View File

@ -316,6 +316,7 @@ public class Board {
public String[] toFileRep() {
String myFile = toString();
myFile += "\n" + Integer.toString(turns);
String[] myArray = myFile.split("\n");
return myArray;
}
@ -326,7 +327,6 @@ public class Board {
this.board = new Piece[lineNum][colNum];
this.x = -1;
this.y = -1;
//this.turns = turns;
String[] line;
boolean white;
@ -348,6 +348,10 @@ public class Board {
if (array[lineNum].charAt(0) == 'B') {
whiteTurn = false;
}
this.turns = Integer.parseInt(array[lineNum+1]);
states = new ArrayList<>();
states.add(toString());
}