public TankAction GetBestTankAction() { TankAction bestAction = TankAction.NONE; if (IsTankActionDetermined) { bestAction = ChosenTankAction; } else { double bestValue = double.NegativeInfinity; foreach (TankAction tankAction in TankHelper.TankActions) { TankActionSituation tankActSit = TankActionSituationsPerTankAction[(int)tankAction]; if (tankActSit.IsValid) { double actionValue = tankActSit.Value; if (actionValue > bestValue) { bestValue = actionValue; bestAction = tankAction; } } } } return(bestAction); }
public void UpdateTankActionSituations(GameState currentGameState) { foreach (TankAction tankAction in TankHelper.TankActions) { GameState newGameState = currentGameState.Clone(); newGameState.Tick++; TankActionSituation tankActSit = new TankActionSituation(this, tankAction); tankActSit.UpdateTankActionSituation(this, tankAction, newGameState); TankActionSituationsPerTankAction[(int)tankAction] = tankActSit; } }
public double GetBestTankActionValue() { double bestValue = double.NegativeInfinity; foreach (TankAction tankAction in TankHelper.TankActions) { TankActionSituation tankActSit = TankActionSituationsPerTankAction[(int)tankAction]; if (tankActSit.IsValid) { double actionValue = tankActSit.Value; if (actionValue > bestValue) { bestValue = actionValue; } } } return(bestValue); }
public void AdjustTankActionValue(TankAction tankAction, double valueModification) { TankActionSituation tankActSit = TankActionSituationsPerTankAction[(int)tankAction]; tankActSit.Value += valueModification; }