Merge branch 'master' of https://gitarero.ecam.fr/noa.four/OOP_1B2_Project.git
This commit is contained in:
commit
be0d7e417f
|
|
@ -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,13 +6,13 @@ 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;
|
||||
this.toX = toX;
|
||||
this.toY = toY;
|
||||
this.capturedPiece = capturedPiece;
|
||||
//this.capturedPiece = capturedPiece;
|
||||
}
|
||||
public Piece getPiece() {
|
||||
return piece;
|
||||
|
|
@ -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
|
||||
/// mjs
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue