static void Main(string[] args)
        {
            Console.WriteLine("Prašau įveskite generacijų skaičių.");
            int.TryParse(Console.ReadLine(), out int numberOfGenerations);

            var life = new Life(10);

            // inicijuojame šabloną "Toad"
            life.ToggleCell(4, 1);
            life.ToggleCell(4, 2);
            life.ToggleCell(4, 3);
            life.ToggleCell(5, 0);
            life.ToggleCell(5, 1);
            life.ToggleCell(5, 2);

            for (var i = 0; i < numberOfGenerations; i++)
            {
                if (i == 0)
                {
                    life.BeginGeneration();
                }
                else
                {
                    life.Update();
                }

                life.Wait();
                OutputBoard(life);
            }

            Console.ReadKey();
        }
예제 #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            // TODO: Add your update logic here

            life.Update(gameTime);

            base.Update(gameTime);
        }