Compare commits

...

7 Commits

2 changed files with 19 additions and 4 deletions

View File

@ -106,8 +106,22 @@ public class Board {
}
public String toString() {
//TODO
return "";
PresentState ps = new PresentState();
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));
}
else {
ps.append("--");
}
ps.append(" ");
}
ps.append("\n");
}
return ps.toString("board's present state");
}
public ArrayList<Piece> getPieces() {

View File

@ -6,7 +6,7 @@ public class Move {
private int toX, toY;
private Piece capturedPiece;
public Move ( Piece piece, int fromX, int fromY, int toX, int toY, Piece captured) {
public Move ( Piece piece, int fromX, int fromY, int toX, int toY, Piece capturedPiece){
this.piece = piece;
this.fromX = fromX;
this.fromY = fromY;
@ -36,7 +36,8 @@ public class Move {
return capturedPiece != null;
}
public String toString() {
return piece + ":("+ fromX + "," + fromY + ")-("+ toX + "," + toY + ")" + ( capturedPiece != null? "capturing "+ capturedPiece: "");
return piece + ":("+ fromX + "," + fromY + ")-("+ toX + "," + toY + ")" +
( capturedPiece != null? "capturing "+ capturedPiece: "");
}
// remove commit message
}