Compare commits
7 Commits
a81ad7881f
...
d883a7ace7
| Author | SHA1 | Date |
|---|---|---|
|
|
d883a7ace7 | |
|
|
e0cd23750e | |
|
|
f358d82b51 | |
|
|
617a81b0f9 | |
|
|
ccf5a9a951 | |
|
|
bc7de99585 | |
|
|
e74c60224d |
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue