working on board
This commit is contained in:
parent
dc00037eaa
commit
dff0d5c704
|
|
@ -6,46 +6,51 @@ public class Board {
|
|||
|
||||
public int width;
|
||||
public int height;
|
||||
public ArrayList<Piece> pieces = new ArrayList<>();
|
||||
public int TurnNumber;
|
||||
|
||||
public Board(int colNum, int lineNum) {
|
||||
//TODO
|
||||
this.width = colNum;
|
||||
this.height = lineNum;
|
||||
|
||||
this.TurnNumber=0;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
//TODO
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getHeight() {
|
||||
//TODO
|
||||
return height;
|
||||
}
|
||||
|
||||
public int getTurnNumber() {
|
||||
//TODO
|
||||
return 0;
|
||||
return TurnNumber;
|
||||
}
|
||||
|
||||
public boolean isTurnWhite() {
|
||||
//TODO
|
||||
return false;
|
||||
return (TurnNumber % 2 == 0);;
|
||||
}
|
||||
|
||||
public void setPiece(boolean isWhite, PieceType type, int x, int y) {
|
||||
//TODO
|
||||
pieces.removeIf(p -> p.getX() == x && p.getY() == y);
|
||||
pieces.add(new Piece(x, y, isWhite, type));
|
||||
}
|
||||
|
||||
public void populateBoard() {
|
||||
//TODO
|
||||
if (pieces==null) {
|
||||
pieces = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanBoard() {
|
||||
//TODO
|
||||
if (pieces != null) {
|
||||
pieces.clear();
|
||||
}
|
||||
else {
|
||||
pieces = new Arraylist<>();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue