This commit is contained in:
Admin 2025-05-06 14:25:55 +02:00
parent 3034482e08
commit 5f8450adc0
1 changed files with 22 additions and 9 deletions

View File

@ -92,20 +92,33 @@ public class Board {
} }
public String toString() { public String toString() {
//TODO String result = "";
return ""; for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
char c = ' ';
for (Piece p : pieces) {
if (p.getX() == x && p.getY() == y) {
if(p.isWhite() == true) {
c = 'W';
String letter =p.getType().name();
c += letter.charAt(0);
} }
if(p.isWhite() == false) {
public ArrayList<Piece> getPieces() { c = 'B';
ArrayList<Piece> result = new ArrayList<>(); String letter =p.getType().name();
for (Piece p : this.pieces) { c += letter.charAt(0);
result.add(p); }
}
}
result += c + " ";
}
result += "\n";
} }
return result; return result;
} }
public void userTouch(int x, int y) { public void userTouch(int x, int y) {
//TODO
} }