Esempio n. 1
0
        private void InitializeMembers(GameUniverse currentGenerationGameUniverse)
        {
            _aliveNeighboursCountForCurrentlyAlivePoints = new Dictionary <Point, int>();
            _aliveNeighboursCountForCurrentlyDeadPoints  = new Dictionary <Point, int>();

            _gameUniverse    = currentGenerationGameUniverse;
            _aliveCellPoints = currentGenerationGameUniverse.AliveCells.Select(x => new VisitablePoint(x)).ToList();
        }
Esempio n. 2
0
        public List <Point> GetAliveCellsForNextGeneration(GameUniverse currentGenerationGameUniverse)
        {
            InitializeMembers(currentGenerationGameUniverse);
            CalculateCandidatePointsForNextGeneration();
            List <Point> alivePointsForNextGenerationThatAreCurrentlyDead  = GetAlivePointsForNextGenerationThatAreCurrentlyDead();
            List <Point> alivePointsForNextGenerationThatAreCurrentlyAlive = GetAlivePointsForNextGenerationThatAreCurrentlyAlive();
            var          alivePointsForNextGeneration = new List <Point>(alivePointsForNextGenerationThatAreCurrentlyDead);

            alivePointsForNextGeneration.AddRange(alivePointsForNextGenerationThatAreCurrentlyAlive);

            return(alivePointsForNextGeneration);
        }
Esempio n. 3
0
 // TODO - set up DI container to discover Generation Strategy
 public GameController(IGenerationSrategy generationSrategy, GameUniverse gameUniverse)
 {
     _generationSrategy = generationSrategy;
     _gameUniverse      = gameUniverse;
 }