turn number doesn't work after loading file
This commit is contained in:
parent
e5cddf031b
commit
87f6595e52
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue