Skip to content
Snippets Groups Projects
Commit 6ab73222 authored by dragapsy's avatar dragapsy
Browse files

Tache 4 (La methode nextColor(Cell cell) de la classe DistinctColorGenerator).

parent fba54ad4
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,18 @@ public class DistinctColorGenerator implements ColorGenerator {
}
@Override
public Color nextColor(Cell cell) {
return null;
List<Cell> neighbours = cell.getNeighbours();
for (Color color : this.colors) {
boolean cellNotUsed = true;
for (Cell newCell : neighbours) {
if (color==cell.getColor())
{ cellNotUsed = false; }
}
if (cellNotUsed == true) {
return color;
}
}
return this.defaultColor;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment