toString final
This commit is contained in:
parent
fbce3ce878
commit
7a0fad8514
|
|
@ -92,8 +92,25 @@ public class Board {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
//TODO
|
||||
return "";
|
||||
String result = "";
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
String c = ".";
|
||||
for (Piece p : pieces) {
|
||||
if (p.getX() == x && p.getY() == y) {
|
||||
String letter = p.getType().getSummary();
|
||||
if (p.isWhite()) {
|
||||
c = "W" + letter;
|
||||
} else {
|
||||
c = "B" + letter;
|
||||
}
|
||||
}
|
||||
}
|
||||
result += c + " ";
|
||||
}
|
||||
result += "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ArrayList<Piece> getPieces() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue