Add return of new cell state to advanceState Function
This commit is contained in:
parent
3676264444
commit
9fb67d0194
1 changed files with 5 additions and 1 deletions
|
@ -11,11 +11,15 @@ class Cell {
|
||||||
|
|
||||||
Cell([bool state = false]) : this.state = state;
|
Cell([bool state = false]) : this.state = state;
|
||||||
|
|
||||||
void advanceState() {
|
// Sets the actual state to what it should be next update
|
||||||
|
// Returns the newly assumed actual state of the cell.
|
||||||
|
bool advanceState() {
|
||||||
this.state = this.nextState;
|
this.state = this.nextState;
|
||||||
this.nextState = false;
|
this.nextState = false;
|
||||||
|
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
|
|
||||||
|
return this.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(int neighbors) {
|
void update(int neighbors) {
|
||||||
|
|
Loading…
Reference in a new issue