public DecisionTree(IMapController map, AIEasy ai) { actionSource = new List<ActionSource>(); activeState = new ActiveState(); this.map = map; this.ai = ai; BuildTree(); }
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; }
public void ClearActiveObjects() { activeState = new ActiveState(); }
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); } } } }
public ActionSource(DelAction action, GetPrice getPrice) { this.action = action; this.getPrice = getPrice; state = new ActiveState(); }