From 4e0f5ad0c480e94dc2b7d9226d9bc924704e07b5 Mon Sep 17 00:00:00 2001 From: Aubin DORIVAL Date: Mon, 24 Mar 2025 10:33:13 +0100 Subject: [PATCH] cells --- src/Color.java | 1 - src/GomokuCell.java | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Color.java b/src/Color.java index 11d1185..86b6b62 100644 --- a/src/Color.java +++ b/src/Color.java @@ -1,7 +1,6 @@ public enum Color { - NIL, WHITE, BLACK; diff --git a/src/GomokuCell.java b/src/GomokuCell.java index b35a513..6a6662b 100644 --- a/src/GomokuCell.java +++ b/src/GomokuCell.java @@ -2,10 +2,11 @@ import java.util.EnumMap; public class GomokuCell{ private EnumMap neighbour; - public Color state; + private Color state; - public GomokuCell(){ + public GomokuCell(Color state){ this.neighbour = new EnumMap<>(Cardinal.class); + this.state = state; } public void linkCell(Cardinal car, GomokuCell cell){ @@ -16,6 +17,18 @@ public class GomokuCell{ 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 getAllNeighbour(){ return neighbour; }