コード例 #1
0
        public void RunGame()
        {
            _grid.SetUpGrid(Constants.GridLength, Constants.GridWidth);
            _grid.Initialise();
            var grid = _grid;

            //_universeGeneratorLogger.LogInformation("New universe grid created", grid);
            do
            {
                while (!_input.ConsoleKeyAvailable())
                {
                    _output.Clear();
                    _output.WriteLine("Welcome to Game of Life");
                    _output.WriteLine($"Press 'Q' to stop {System.Environment.NewLine}");

                    PrintGrid?.Invoke(this, new GridPrintEventArgs(_output, grid.Grid));
                    grid = _game.LoopThroughEachCell();
                    Thread.Sleep(400);
                    var hashCode = grid.GetHashCode();
                    //_universeGeneratorLogger.LogInformation($"This is the Grid's hashcode: {hashCode}");
                }
            }while (_input.ReadKey(true).Key != ConsoleKey.Q);
        }