Esempio n. 1
0
        static void Main(string[] args)
        {
            var time = DateTime.Now;

            Console.Write("Enter height: ");
            int.TryParse(Console.ReadLine(), out int height);

            Console.Write("Enter width: ");
            int.TryParse(Console.ReadLine(), out int width);

            Console.Write("Enter the shape of your living cells (dead cells will be just empty spaces): ");
            string shape = Console.ReadLine();

            Console.Clear();

            var life = new CellController(shape);

            life.GenerateCells(height, width);

            life.DrawCells();
            while (life.GameIsNotOver)
            {
                var newTime = DateTime.Now;
                if (newTime.Second != time.Second)
                {
                    time = newTime;
                    life.UpdateGrid();
                    life.DrawCells();
                }
            }

            Console.WriteLine("Game is over. No conditions for the cells to reproduce.");
        }
Esempio n. 2
0
    void Start()
    {
        Life = GetComponent <CellController>();      // Instantiate Cell Controller

        Life.GenerateCells();
        Life.DrawCells();
        time = DateTime.Now;
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        var newTime = DateTime.Now;

        if (newTime.Second != time.Second)
        {
            time = newTime;
            Life.UpdateGrid();
            Life.DrawCells();
        }
    }