Пример #1
0
        public DecisionTree(IMapController map, AIEasy ai)
        {
            actionSource = new List<ActionSource>();
            activeState = new ActiveState();

            this.map = map;
            this.ai = ai;

            BuildTree();
        }
Пример #2
0
 public void SetState(ActiveState activeState)
 {
     state.activeLicenceKind = activeState.activeLicenceKind;
     state.activeRoad = activeState.activeRoad;
     state.activeSourceKind = activeState.activeSourceKind;
     state.activeTown = activeState.activeTown;
     state.activeTownPos = activeState.activeTownPos;
     state.activeSourceBuildingKind = activeState.activeSourceBuildingKind;
     state.activeUpgradeKind = activeState.activeUpgradeKind;
     state.activePlayer = activeState.activePlayer;
     state.activeHexa = activeState.activeHexa;
 }
Пример #3
0
 public void ClearActiveObjects()
 {
     activeState = new ActiveState();
 }
Пример #4
0
        private void TryMakeAction()
        {
            if (actionSource.Count > 0)
            {
                ActionSource bestAction = null;
                int bestPrice = 1000;

                foreach (ActionSource action in actionSource)
                {
                    int price = action.GetSourceChange();
                    if (price + 15 < bestPrice)
                    {
                        bestPrice = price;
                        bestAction = action;
                    }
                }

                {
                    activeState = bestAction.GetState();
                    //if (map.CanChangeSourcesFor(map.GetPrice(bestAction.GetPriceKind())) >= 0)
                    {
                        PriceKind kind = bestAction.GetPriceKind();
                        map.ChangeSourcesFor(map.GetPrice(kind));
                        bestAction.GetAction()();
                        SetWasAction(true);
                    }
                }
            }
        }
Пример #5
0
 public ActionSource(DelAction action, GetPrice getPrice)
 {
     this.action = action;
     this.getPrice = getPrice;
     state = new ActiveState();
 }