end of part 1
This commit is contained in:
parent
1233bf9fda
commit
b01ceb96f5
|
|
@ -9,6 +9,8 @@ public class Board {
|
|||
private Piece[][] board;
|
||||
private int x;
|
||||
private int y;
|
||||
private int turns;
|
||||
private boolean whiteTurn;
|
||||
|
||||
public Board(int colNum, int lineNum) {
|
||||
this.colNum = colNum;
|
||||
|
|
@ -16,6 +18,8 @@ public class Board {
|
|||
this.board = new Piece[lineNum][colNum];
|
||||
x = -1;
|
||||
y = -1;
|
||||
turns = 0;
|
||||
whiteTurn = true;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
|
|
@ -27,13 +31,11 @@ public class Board {
|
|||
}
|
||||
|
||||
public int getTurnNumber() {
|
||||
//TODO
|
||||
return 0;
|
||||
return turns;
|
||||
}
|
||||
|
||||
public boolean isTurnWhite() {
|
||||
//TODO
|
||||
return false;
|
||||
return whiteTurn;
|
||||
}
|
||||
|
||||
public void setPiece(boolean isWhite, PieceType type, int x, int y) {
|
||||
|
|
@ -147,8 +149,15 @@ public class Board {
|
|||
board[this.y][this.x].setY(y);
|
||||
board[y][x] = board[this.y][this.x];
|
||||
board[this.y][this.x] = null;
|
||||
turns += 1;
|
||||
this.x = -1;
|
||||
this.y = -1;
|
||||
if (whiteTurn == true) {
|
||||
whiteTurn = false;
|
||||
}
|
||||
else {
|
||||
whiteTurn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue