Saving progress for toString, does not work
This commit is contained in:
parent
164481ca87
commit
e44c7ad881
|
|
@ -6,12 +6,15 @@ 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<>();
|
||||
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
|
|
@ -72,9 +75,21 @@ public class Board {
|
|||
pieces.clear();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
//TODO
|
||||
return "";
|
||||
public String toString(ArrayList<Piece> pieces) {
|
||||
|
||||
String[] boardStateStr = "";
|
||||
|
||||
for(Piece piece : pieces) {
|
||||
Boolean colorofpiece = piece.isWhite();
|
||||
if(colorofpiece == true) {
|
||||
boardState.add("White");
|
||||
}
|
||||
else {
|
||||
boardState.add("Black");
|
||||
}
|
||||
|
||||
}
|
||||
return boardStateStr;
|
||||
}
|
||||
|
||||
public ArrayList<Piece> getPieces() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue