Exemple #1
0
 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;
 }
Exemple #2
0
 public Ruleset(Ruleset existingRuleset)
 {
     BirthMaximum = existingRuleset.BirthMaximum;
     BirthMinimum = existingRuleset.BirthMinimum;
     SurvivalMaximum = existingRuleset.SurvivalMaximum;
     SurvivalMinimum = existingRuleset.SurvivalMinimum;
 }
Exemple #3
0
 public Population(Population existingPopulation)
 {
     CellList = new List<Cell>();
     Rules = existingPopulation.Rules;
     foreach (Cell thisCell in existingPopulation.CellList)
         CellList.Add(new Cell(thisCell));
 }
Exemple #4
0
        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;
        }
Exemple #5
0
 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;
 }
Exemple #6
0
 public Population(Ruleset rules)
 {
     CellList = new List<Cell>();
     Rules = rules;
 }
Exemple #7
0
        private bool Survive(Cell checkCell, Ruleset rules)
        {
            if (checkCell.NeighborCount >= rules.SurvivalMinimum && checkCell.NeighborCount <= rules.SurvivalMaximum)
                return true;

            return false;
        }