Saving system done
This commit is contained in:
parent
a81ad7881f
commit
718242d8ec
|
|
@ -196,10 +196,22 @@ public class Board {
|
||||||
/* saving-loading feature :*/
|
/* saving-loading feature :*/
|
||||||
|
|
||||||
public String[] toFileRep() {
|
public String[] toFileRep() {
|
||||||
//TODO
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
return null;
|
|
||||||
|
for (int y = 0; y < 8; y++) {
|
||||||
|
for (int x = 0; x < 8; x++) {
|
||||||
|
Piece piece = cells[x][y];
|
||||||
|
if (piece != null) {
|
||||||
|
String line = piece.isWhite() + " " + piece.getType() + " " + x + " " + y;
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Board(String[] array) {
|
public Board(String[] array) {
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue