Ejemplo n.º 1
0
        protected override void ConfigureGame()
        {
            _gridRenderer.StartSession();

            if (string.IsNullOrWhiteSpace(_configuration.Filename))
            {
                _grid = new Grid <GameOfLifeCellMetadata>(new Dimensions2D(_configuration.Width, _configuration.Height), new GameOfLifeRandomCellGenerator(_configuration.LifeProbability));
            }
            else
            {
                var parser = new GameOfLifeParsingCellGenerator(File.OpenText(_configuration.Filename).ReadToEnd());
                _grid = new Grid <GameOfLifeCellMetadata>(new Dimensions2D(parser.MaxWidth, parser.MaxHeight), parser);
            }

            _initialGrid = _grid;

            ResetSimulation();

            _gridRenderer.PromptToContinue();

            AutoIncrementRound = TimeSpan.FromMilliseconds(_configuration.Interval);
        }