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() {
//TODO
return "";
String result = "";
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);
}
public ArrayList<Piece> getPieces() {
ArrayList<Piece> result = new ArrayList<>();
for (Piece p : this.pieces) {
result.add(p);
if(p.isWhite() == false) {
c = 'B';
String letter =p.getType().name();
c += letter.charAt(0);
}
}
}
result += c + " ";
}
result += "\n";
}
return result;
}
public void userTouch(int x, int y) {
//TODO
}