Add pieces into board
This commit is contained in:
parent
af871e6b72
commit
7759adb994
|
|
@ -7,6 +7,11 @@ public class Board {
|
|||
private int width;
|
||||
private int height;
|
||||
private ArrayList<Piece> pieces;
|
||||
private int turnNumber = 0;
|
||||
private boolean turnWhite = true;
|
||||
private int[] selected = null; //for user touch
|
||||
private ArrayList<int[]> highlighted = new ArrayList<>();
|
||||
private ArrayList<Move> moveHistory = new ArrayList<>();
|
||||
|
||||
public Board(int colNum, int lineNum) {
|
||||
this.width = colNum;
|
||||
|
|
@ -27,12 +32,12 @@ public class Board {
|
|||
|
||||
public int getTurnNumber() {
|
||||
//TODO
|
||||
return 0;
|
||||
return turnNumber;
|
||||
}
|
||||
|
||||
public boolean isTurnWhite() {
|
||||
//TODO
|
||||
return false;
|
||||
return turnWhite;
|
||||
}
|
||||
|
||||
public void setPiece(boolean isWhite, PieceType type, int x, int y) {
|
||||
|
|
@ -110,13 +115,13 @@ public class Board {
|
|||
}
|
||||
|
||||
public ArrayList<Piece> getPieces() {
|
||||
ArrayList<Piece> pieces = new ArrayList<>();
|
||||
//TODO
|
||||
|
||||
return pieces;
|
||||
}
|
||||
|
||||
public void userTouch(int x, int y) {
|
||||
|
||||
//TODO
|
||||
|
||||
}
|
||||
|
|
@ -141,6 +146,9 @@ public class Board {
|
|||
/* The following methods require more work ! */
|
||||
|
||||
public boolean isHighlighted(int x, int y) {
|
||||
for (int[] pos : highlighted) {
|
||||
if (pos[0] == x && pos[1] == y) return true;
|
||||
}
|
||||
//TODO
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue