toString
This commit is contained in:
parent
3034482e08
commit
5f8450adc0
|
|
@ -92,20 +92,33 @@ public class Board {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
//TODO
|
||||
return "";
|
||||
}
|
||||
|
||||
public ArrayList<Piece> getPieces() {
|
||||
ArrayList<Piece> result = new ArrayList<>();
|
||||
for (Piece p : this.pieces) {
|
||||
result.add(p);
|
||||
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);
|
||||
}
|
||||
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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue