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 BioCell(IPlayer player, int cellIndex, Color cellColor, ISurroundingCellCalculator surroundingCellCalculator) : base(cellIndex, false, false, true, false)
 {
     Player      = player;
     CellColor   = cellColor;
     OutOfGrid   = false;
     OrganicCell = true;
     _surroundingCellCalculator = surroundingCellCalculator;
 }
Ejemplo n.º 3
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.º 4
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;
     }
 }
 private static BioCell CreateBioCell(Player player, int cellIndex, ISurroundingCellCalculator surroundingCellCalculatorMock)
 {
     return(new BioCell(player, cellIndex, player.Color, surroundingCellCalculatorMock));
 }
Ejemplo n.º 6
0
 public CellRegrowthCalculator(ISurroundingCellCalculator surroundingCellCalculator)
 {
     _surroundingCellCalculator = surroundingCellCalculator;
 }