Add return of new cell state to advanceState Function

This commit is contained in:
Marty Oehme 2018-07-08 19:08:40 +02:00
parent 3676264444
commit 9fb67d0194

View file

@ -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) {