-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoardCell.java
More file actions
44 lines (37 loc) · 1 KB
/
BoardCell.java
File metadata and controls
44 lines (37 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//---------------imports------------------
import java.util.*;
//handle gui later
//will probably be changed to buttons
public class BoardCell {
//position of the board cell
private int col;
private int row;
public static final int size=64;
private Piece p;
public boolean isWhite;
//TODO: add color chosing in the board class
//-------------------------methods+ctor--------------------------------
public BoardCell(int row, int col) {
this.col = col;
this.row = row;
this.p=null;//so that later we can check if has piece
}
public void setPiece(Piece p) {
this.p = p;
}
public int[] getPosition() {
return new int[]{this.col*size, this.row*size};//returns {x,y}
}
public Piece getPiece(){
return this.p;
}
public void draw(){}
public void print(){
if(this.p!=null){
System.out.print(p.toChar());
}
else{
System.out.print("-");
}
}
}