Ejemplo n.º 1
0
        public ResourceBalanceStrategy(
            IYieldEstimator yieldEstimator, IResourceNodeFactory resourceNodeFactory,
            IResourceRestrictionLogic resourceRestrictionCanon, ICellScorer cellScorer, ITechCanon techCanon,
            IStrategicCopiesLogic strategicCopiesLogic, IWeightedRandomSampler <IHexCell> cellRandomSampler,
            [Inject(Id = "Available Resources")] IEnumerable <IResourceDefinition> availableResources,
            IWeightedRandomSampler <IResourceDefinition> resourceRandomSampler
            )
        {
            YieldEstimator           = yieldEstimator;
            ResourceNodeFactory      = resourceNodeFactory;
            ResourceRestrictionCanon = resourceRestrictionCanon;
            CellScorer            = cellScorer;
            TechCanon             = techCanon;
            StrategicCopiesLogic  = strategicCopiesLogic;
            CellRandomSampler     = cellRandomSampler;
            ResourceRandomSampler = resourceRandomSampler;

            foreach (var yieldType in EnumUtil.GetValues <YieldType>())
            {
                BonusResourcesWithYield[yieldType] = availableResources.Where(
                    resource => resource.Type == ResourceType.Bonus &&
                    YieldEstimator.GetYieldEstimateForResource(resource)[yieldType] > 0f
                    ).ToArray();
            }

            ScoreIncreasingCandidates = availableResources.Where(resource => resource.Type != ResourceType.Luxury).ToList();
        }
Ejemplo n.º 2
0
 public CellScorer(
     IYieldEstimator yieldEstimator, IMapScorer mapScorer, ITechCanon techCanon,
     IPossessionRelationship <IHexCell, IResourceNode> nodeLocationCanon
     )
 {
     YieldEstimator    = yieldEstimator;
     MapScorer         = mapScorer;
     TechCanon         = techCanon;
     NodeLocationCanon = nodeLocationCanon;
 }
Ejemplo n.º 3
0
 public HomelandBalancer(
     IYieldEstimator yieldEstimator, ICellScorer cellScorer, ITechCanon techCanon,
     IWeightedRandomSampler <IBalanceStrategy> balanceStrategySampler
     )
 {
     YieldEstimator         = yieldEstimator;
     CellScorer             = cellScorer;
     TechCanon              = techCanon;
     BalanceStrategySampler = balanceStrategySampler;
 }
Ejemplo n.º 4
0
 public HillsBalanceStrategy(
     IYieldEstimator yieldEstimator, IMapScorer mapScorer,
     IPossessionRelationship <IHexCell, IResourceNode> nodeLocationCanon,
     ICellModificationLogic modLogic, ITechCanon techCanon
     )
 {
     YieldEstimator    = yieldEstimator;
     MapScorer         = mapScorer;
     NodeLocationCanon = nodeLocationCanon;
     ModLogic          = modLogic;
     TechCanon         = techCanon;
 }
Ejemplo n.º 5
0
 public LakeBalanceStrategy(
     IHexGrid grid, IYieldEstimator yieldEstimator, IMapScorer mapScorer,
     IPossessionRelationship <IHexCell, IResourceNode> nodePositionCanon,
     ICellModificationLogic modLogic, ITechCanon techCanon
     )
 {
     Grid              = grid;
     YieldEstimator    = yieldEstimator;
     MapScorer         = mapScorer;
     NodePositionCanon = nodePositionCanon;
     ModLogic          = modLogic;
     TechCanon         = techCanon;
 }
 public OasisBalanceStrategy(
     IHexGrid grid, IYieldEstimator yieldEstimator, ITechCanon techCanon,
     IMapScorer mapScorer, ICellModificationLogic modLogic,
     IPossessionRelationship <IHexCell, IResourceNode> nodePositionCanon,
     IWeightedRandomSampler <IHexCell> cellRandomSampler
     )
 {
     Grid              = grid;
     YieldEstimator    = yieldEstimator;
     TechCanon         = techCanon;
     MapScorer         = mapScorer;
     ModLogic          = modLogic;
     NodePositionCanon = nodePositionCanon;
     CellRandomSampler = cellRandomSampler;
 }