Ejemplo n.º 1
0
 private void InitializeDependencies()
 {
     _cellGrowthCalculator      = new CellGrowthCalculator();
     _surroundingCellCalculator = new SurroundingCellCalculator(GameSettings.NumberOfColumnsAndRows);
     _cellRegrowthCalculator    = new CellRegrowthCalculator(_surroundingCellCalculator);
     _generationAdvancer        = new GenerationAdvancer(_cellRegrowthCalculator);
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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;
     }
 }