private void InitializeDependencies() { _cellGrowthCalculator = new CellGrowthCalculator(); _surroundingCellCalculator = new SurroundingCellCalculator(GameSettings.NumberOfColumnsAndRows); _cellRegrowthCalculator = new CellRegrowthCalculator(_surroundingCellCalculator); _generationAdvancer = new GenerationAdvancer(_cellRegrowthCalculator); }
public Player(string name, Color playerCellColor, int playerNumber, ICellGrowthCalculator cellGrowthCalculator, ISurroundingCellCalculator surroundingCellCalculator, bool isHuman) { Name = name; Color = playerCellColor; PlayerNumber = playerNumber; _cellGrowthCalculator = cellGrowthCalculator; _surroundingCellCalculator = surroundingCellCalculator; IsHuman = isHuman; _growthScorecard = new GrowthScorecard(); }
public AiPlayer(string name, Color playerCellColor, int playerNumber, ICellGrowthCalculator cellGrowthCalculator, ISurroundingCellCalculator surroundingCellCalculator, bool isHuman, AiType?aiType = null) : base(name, playerCellColor, playerNumber, cellGrowthCalculator, surroundingCellCalculator, isHuman) { if (aiType == null) { var numberOfMembers = Enum.GetNames(typeof(AiType)).Length; var aiTypeIndex = RandomNumberGenerator.Random.Next(0, numberOfMembers - 1); AiType = (AiType)aiTypeIndex; } else { AiType = aiType.Value; } }