import 'package:rules_of_living/Rule.dart'; class Cell { bool state; bool nextState = false; List surviveRules = new List(); List birthRules = new List(); Cell([bool state = false]) : this.state = state; void advanceState() { this.state = this.nextState; this.nextState = false; } void update(int neighbors) { if (state == true) { surviveRules.forEach( (Rule rule) { if(rule.evaluate(neighbors) == true) this.nextState = true; }); } else { birthRules.forEach((Rule rule) { if (rule.evaluate(neighbors) == true) this.nextState = true; }); } } }