CellsAutomate.Food.RandomRainOfFoodStrategy.Build C# (CSharp) Method

Build() public method

public Build ( bool creatures, FoodMatrix eatMatrix ) : void
creatures bool
eatMatrix FoodMatrix
return void
        public void Build(bool[,] creatures, FoodMatrix eatMatrix)
        {
            for (int i = 0; i < eatMatrix.Length; i++)
            {
                for (int j = 0; j < eatMatrix.Height; j++)
                {
                    if (!creatures[i, j]
                        && !eatMatrix.HasMaxFoodLevel(new Point(i, j))
                        && _random.Next(100) % _frequency == 0)
                    {
                        eatMatrix.AddFood(new Point(i, j));
                    }
                }
            }
        }
RandomRainOfFoodStrategy