Skip to content
Snippets Groups Projects
Commit 04a2093b authored by HAMADACHE Mohamed's avatar HAMADACHE Mohamed
Browse files

ok

parent adb13dc8
Branches
No related tags found
No related merge requests found
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
public class Cell { public class Cell {
private boolean isAlive; private boolean isAlive;
private boolean isBlue;
public Cell() { public Cell() {
this.isAlive = false; this.isAlive = false;
this.isBlue = false;
} }
/** /**
...@@ -19,6 +21,10 @@ public class Cell { ...@@ -19,6 +21,10 @@ public class Cell {
return this.isAlive; return this.isAlive;
} }
public boolean isBlue() {
return this.isBlue;
}
/** /**
* Determines whether this {@link Cell} is dead or not. * Determines whether this {@link Cell} is dead or not.
* *
...@@ -29,6 +35,10 @@ public class Cell { ...@@ -29,6 +35,10 @@ public class Cell {
return !this.isAlive; return !this.isAlive;
} }
public boolean isRed() {
return !this.isBlue;
}
/** /**
* Sets the state of this {@link Cell} to alive. * Sets the state of this {@link Cell} to alive.
* *
...@@ -39,6 +49,11 @@ public class Cell { ...@@ -39,6 +49,11 @@ public class Cell {
this.isAlive = true; this.isAlive = true;
} }
public void setBlue() {
this.isBlue = true;
}
/** /**
* Sets the state of this {@link Cell} to dead. * Sets the state of this {@link Cell} to dead.
* *
...@@ -49,6 +64,10 @@ public class Cell { ...@@ -49,6 +64,10 @@ public class Cell {
this.isAlive = false; this.isAlive = false;
} }
public void setRed() {
this.isBlue = false;
}
/** /**
* Change the state of this {@link Cell} from ALIVE to DEAD or from DEAD to ALIVE. * Change the state of this {@link Cell} from ALIVE to DEAD or from DEAD to ALIVE.
...@@ -67,8 +86,7 @@ public class Cell { ...@@ -67,8 +86,7 @@ public class Cell {
return true; return true;
else else
return false; return false;
} } else {
else{
if (numberOfAliveNeighbours == 3) if (numberOfAliveNeighbours == 3)
return true; return true;
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment