public Main(int birthMin, int birthMax, int survivalMin, int survivalMax, int maxIterations, Population pop) { Rules = new Ruleset(birthMin, birthMax, survivalMin, survivalMax); LivingCells = pop; CurrentIteration = 0; MaxIterations = maxIterations; }
public Ruleset(Ruleset existingRuleset) { BirthMaximum = existingRuleset.BirthMaximum; BirthMinimum = existingRuleset.BirthMinimum; SurvivalMaximum = existingRuleset.SurvivalMaximum; SurvivalMinimum = existingRuleset.SurvivalMinimum; }
public Population(Population existingPopulation) { CellList = new List<Cell>(); Rules = existingPopulation.Rules; foreach (Cell thisCell in existingPopulation.CellList) CellList.Add(new Cell(thisCell)); }
public Population Run(Ruleset rules) { Population tempPop = new Population(this); for (int index = 0; index < CellList.Count; index++) { if (!Survive(CellList[index], rules)) tempPop.RemoveCell(CellList[index]); } tempPop.UpdateCellCount(); Reproduction(tempPop); return tempPop; }
public Main(int birthMin, int birthMax, int survivalMin, int survivalMax, int maxIterations) { Rules = new Ruleset(birthMin, birthMax, survivalMin, survivalMax); LivingCells = new Population(Rules); CurrentIteration = 0; }
public Population(Ruleset rules) { CellList = new List<Cell>(); Rules = rules; }
private bool Survive(Cell checkCell, Ruleset rules) { if (checkCell.NeighborCount >= rules.SurvivalMinimum && checkCell.NeighborCount <= rules.SurvivalMaximum) return true; return false; }