Exemple #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();
        }
Exemple #2
0
        public StrategicDistributor(
            IResourceNodeFactory nodeFactory, IResourceRestrictionLogic resourceRestrictionCanon,
            IStrategicCopiesLogic strategicCopiesLogic, IWeightedRandomSampler <IHexCell> cellRandomSampler,
            [Inject(Id = "Available Resources")] IEnumerable <IResourceDefinition> availableResources,
            IWeightedRandomSampler <IResourceDefinition> resourceRandomSampler
            )
        {
            NodeFactory = nodeFactory;
            ResourceRestrictionCanon = resourceRestrictionCanon;
            StrategicCopiesLogic     = strategicCopiesLogic;
            CellRandomSampler        = cellRandomSampler;
            ResourceRandomSampler    = resourceRandomSampler;

            StrategicResources = availableResources.Where(resource => resource.Type == ResourceType.Strategic);
        }