Fix toString method
This commit is contained in:
parent
d883a7ace7
commit
e01db0d8cf
|
|
@ -106,22 +106,21 @@ public class Board {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
PresentState ps = new PresentState();
|
||||
ArrayList<String> ps=new ArrayList<>();
|
||||
for(int y=0;y<lNum;y++) {
|
||||
for (int x;x<cNum;x++) {
|
||||
Piece piece = getPieces(x,y);
|
||||
if(piece!=null) {
|
||||
ps.append(piece.isWhite()?"W":"B");
|
||||
ps.append(piece.getType().toString().charAt(0));
|
||||
for (int x=0; x<cNum; x++) {
|
||||
if(selectedCell!=null) {
|
||||
ps.add(selectedCell.isWhite()?"W":"B");
|
||||
ps.add(selectedCell.getType().toString());
|
||||
}
|
||||
else {
|
||||
ps.append("--");
|
||||
ps.add("--");
|
||||
}
|
||||
ps.append(" ");
|
||||
ps.add(" ");
|
||||
}
|
||||
ps.append("\n");
|
||||
ps.add("\n");
|
||||
}
|
||||
return ps.toString("board's present state");
|
||||
return ps.toString();
|
||||
}
|
||||
|
||||
public ArrayList<Piece> getPieces() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue