diff --git a/src/main/java/model/State.java b/src/main/java/model/State.java index 1954558460d6969d09544c64c40152d97c1a736e..318e44f2bc68ca54649de512ebec2f178afb7a15 100644 --- a/src/main/java/model/State.java +++ b/src/main/java/model/State.java @@ -44,7 +44,12 @@ public interface State<S> { * @return The number of times the specified state appears in the list of neighbors. */ static <T> int count(T state, List<T> neighbours) { - //TODO: à compléter - return 0; + int nb = 0; + for (T neighbour : neighbours) { + if (state.equals(neighbour)) { + nb++; + } + } + return nb; } } \ No newline at end of file