functional to string method !
This commit is contained in:
parent
e44c7ad881
commit
f7a946b576
|
|
@ -6,14 +6,12 @@ public class Board {
|
|||
private int column;
|
||||
private int line;
|
||||
private ArrayList<Piece> pieces;
|
||||
private ArrayList<String> boardState;
|
||||
|
||||
//initiation of the board, creating an 8 * 8 grid
|
||||
public Board(int colNum, int lineNum) {
|
||||
this.column = colNum;
|
||||
this.line = lineNum;
|
||||
this.pieces = new ArrayList<>();
|
||||
this.boardState = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -74,22 +72,20 @@ public class Board {
|
|||
public void cleanBoard() {
|
||||
pieces.clear();
|
||||
}
|
||||
|
||||
public String toString(ArrayList<Piece> pieces) {
|
||||
|
||||
String[] boardStateStr = "";
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String boardState = "";
|
||||
for(Piece piece : pieces) {
|
||||
Boolean colorofpiece = piece.isWhite();
|
||||
if(colorofpiece == true) {
|
||||
boardState.add("White");
|
||||
if(piece.isWhite() == true) {
|
||||
boardState += "White";
|
||||
}
|
||||
else {
|
||||
boardState.add("Black");
|
||||
boardState += "Black";
|
||||
}
|
||||
//todo piecetype(letter method) + coordinates + saut de ligne
|
||||
|
||||
}
|
||||
return boardStateStr;
|
||||
return boardState;
|
||||
}
|
||||
|
||||
public ArrayList<Piece> getPieces() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue