Пример #1
0
        public Game(int fieldSize, IDisplay displayProvider, Cell[,] firstGen)
        {
            CurrentGen = firstGen;

            _gameField     = new GameField(fieldSize, displayProvider);
            _gameProcessor = new GameProcessor();
            _gameRules     = new GameRules();
            _running       = true;
        }
Пример #2
0
        static void Main(string[] args)
        {
            var consoleOperations = new ConsoleOperations();
            var gridProvider      = new HardCodedGridProvider();

            var gridState = gridProvider.GetGridState();
            var gameRules = new GameRules();
            var grid      = GridFactory.CreateBoundaryLessGrid(gridState);

            var game = new Game(consoleOperations, grid, gameRules);

            game.Start();
        }
Пример #3
0
        static void Main(string[] args)
        {
            //fetch the dependencies - here we just create them
            var neighbourCalculator = new NeighbourCalculator();
            var gameRules           = new GameRules(new LiveCellRule(), new DeadCellRule());
            var evolution           = new Evolution(neighbourCalculator, gameRules);
            var gridRowColumnParser = new GridParser();
            //typically we would create such an object and inject its dependencies
            //using an IoC container

            //Have to reference to via the namespace as the class and namespace are called the same thing.
            GameOfLifeInterface gameOfLife = new GameOfLife.UI.GameOfLife(evolution, gridRowColumnParser);

            gameOfLife.start();
        }