This commit is contained in:
Aubin DORIVAL
2025-03-24 10:33:13 +01:00
parent cea1808cb1
commit 4e0f5ad0c4
2 changed files with 15 additions and 3 deletions

View File

@@ -1,7 +1,6 @@
public enum Color { public enum Color {
NIL, NIL,
WHITE, WHITE,
BLACK; BLACK;

View File

@@ -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;
} }