This commit is contained in:
Noa FOUR 2025-05-06 14:46:12 +02:00
commit 615c17ad42
2 changed files with 16 additions and 4 deletions

View File

@ -209,10 +209,22 @@ public class Board {
/* saving-loading feature :*/
public String[] toFileRep() {
//TODO
return null;
ArrayList<String> lines = new ArrayList<>();
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) {
//TODO

View File

@ -12,7 +12,7 @@ public class Move {
this.fromY = fromY;
this.toX = toX;
this.toY = toY;
this.capturedPiece = capturedPiece;
//this.capturedPiece = capturedPiece;
}
public Piece getPiece() {
return piece;
@ -39,5 +39,5 @@ public class Move {
return piece + ":("+ fromX + "," + fromY + ")-("+ toX + "," + toY + ")" +
( capturedPiece != null? "capturing "+ capturedPiece: "");
}
// remove commit message
/// mjs
}