cells
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
public enum Color {
|
public enum Color {
|
||||||
|
|
||||||
NIL,
|
NIL,
|
||||||
WHITE,
|
WHITE,
|
||||||
BLACK;
|
BLACK;
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import java.util.EnumMap;
|
|||||||
|
|
||||||
public class GomokuCell{
|
public class GomokuCell{
|
||||||
private EnumMap<Cardinal,GomokuCell> neighbour;
|
private EnumMap<Cardinal,GomokuCell> neighbour;
|
||||||
public Color state;
|
private Color state;
|
||||||
|
|
||||||
public GomokuCell(){
|
public GomokuCell(Color state){
|
||||||
this.neighbour = new EnumMap<>(Cardinal.class);
|
this.neighbour = new EnumMap<>(Cardinal.class);
|
||||||
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void linkCell(Cardinal car, GomokuCell cell){
|
public void linkCell(Cardinal car, GomokuCell cell){
|
||||||
@@ -16,6 +17,18 @@ public class GomokuCell{
|
|||||||
return this.neighbour.get(car);
|
return this.neighbour.get(car);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty(){
|
||||||
|
return this.state == Color.NIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPlayed(){
|
||||||
|
return !this.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getSate(){
|
||||||
|
return this.state;
|
||||||
|
}
|
||||||
|
|
||||||
public EnumMap<Cardinal, GomokuCell> getAllNeighbour(){
|
public EnumMap<Cardinal, GomokuCell> getAllNeighbour(){
|
||||||
return neighbour;
|
return neighbour;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user