Skip to content
Snippets Groups Projects
Commit 092af1f0 authored by FARESSE Adam's avatar FARESSE Adam
Browse files

Update Grid.java

parent 8d3445ff
No related branches found
No related tags found
No related merge requests found
......@@ -133,6 +133,29 @@ public class Grid implements Iterable<Cell> {
}
return tableau;
}
private String countColorNeighbours(int rowIndex, int columnIndex) {
String CounterColorCell;
int Red = 0;
int Blue = 0;
for (Cell NeighboursCell : this.getNeighbours(rowIndex, columnIndex)) {
if (NeighboursCell.isAlive()) {
if ((NeighboursCell.getColor()).equals("Red")) {
Red+=1;
}
else {
Blue+=1;
}
}
}
if (Red>Blue) {
CounterColorCell="Red";
}
else {
CounterColorCell="Blue";
}
return CounterColorCell;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment