Example #1
0
        public static TyStateWeights GetDefault()
        {
            TyStateWeights p = new TyStateWeights(1.0f);

            p.SetWeight(WeightType.HealthFactor, 8.7f);
            return(p);
        }
Example #2
0
 public TyStateWeights(TyStateWeights other)
     : this()
 {
     for (int i = 0; i < _weights.Length; i++)
     {
         _weights[i] = other._weights[i];
     }
 }
Example #3
0
        public static TyStateWeights operator -(TyStateWeights lhs, TyStateWeights rhs)
        {
            TyStateWeights p = new TyStateWeights();

            for (int i = 0; i < p._weights.Length; i++)
            {
                p._weights[i] = lhs._weights[i] - rhs._weights[i];
            }

            return(p);
        }
Example #4
0
        public static TyStateWeights operator /(TyStateWeights lhs, float rhs)
        {
            TyStateWeights p = new TyStateWeights();

            for (int i = 0; i < p._weights.Length; i++)
            {
                p._weights[i] = lhs._weights[i] / rhs;
            }

            return(p);
        }
Example #5
0
        public static TyStateWeights UniformLerp(TyStateWeights lhs, TyStateWeights rhs, float t)
        {
            TyStateWeights p = new TyStateWeights();

            for (int i = 0; i < p._weights.Length; i++)
            {
                p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], t);
            }

            return(p);
        }
        private TycheAgentCompetition(TyStateWeights weights, bool heroBasedWeights, int episodeMultiplier, bool adjustEpisodeMultiplier)
        {
            _defaultEpisodeMultiplier = episodeMultiplier;
            _curEpisodeMultiplier     = episodeMultiplier;
            _heroBasedWeights         = heroBasedWeights;

            _analyzer = new TyStateAnalyzer(weights);
            _simTree  = new TySimTree();
            _random   = new Random();

            AdjustEpisodeMultiplier = adjustEpisodeMultiplier;
        }
        /// <summary> Called the first round (might be second round game wise) this agents is able to see the game and his opponent. </summary>
        private void CustomInit(POGame.POGame initialState)
        {
            _hasInitialized = true;

            _playerId             = initialState.CurrentPlayer.PlayerId;
            _analyzer.OwnPlayerId = _playerId;

            if (_heroBasedWeights)
            {
                _analyzer.Weights = TyStateWeights.GetHeroBased(initialState.CurrentPlayer.HeroClass, initialState.CurrentOpponent.HeroClass);
            }
        }
Example #8
0
        public static TyStateWeights UniformRandLerp(TyStateWeights lhs, TyStateWeights rhs, System.Random random, float tMin, float tMax)
        {
            TyStateWeights p = new TyStateWeights();

            for (int i = 0; i < p._weights.Length; i++)
            {
                float t = random.RandFloat(tMin, tMax);
                p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], t);
            }

            return(p);
        }
Example #9
0
        public static TyStateWeights NonUniformLerp(TyStateWeights lhs, TyStateWeights rhs, float[] tValues)
        {
            System.Diagnostics.Debug.Assert(tValues.Length >= (int)WeightType.Count);

            TyStateWeights p = new TyStateWeights();

            for (int i = 0; i < p._weights.Length; i++)
            {
                p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], tValues[i]);
            }

            return(p);
        }
Example #10
0
        public static TycheAgentCompetition GetTrainingAgent(float biasFactor = -1.0f, bool useSecrets = false)
        {
            const bool ADJUST_EPISODES    = false;
            const bool HERO_BASED_WEIGHTS = false;

            var weights = TyStateWeights.GetDefault();

            if (biasFactor >= 0.0f)
            {
                weights.SetWeight(TyStateWeights.WeightType.BiasFactor, biasFactor);
            }

            var agent = new TycheAgentCompetition(weights, HERO_BASED_WEIGHTS, 0, ADJUST_EPISODES);

            agent.UsedAlgorithm = Algorithm.Greedy;
            agent._analyzer.EstimateSecretsAndSpells = useSecrets;

            return(agent);
        }
Example #11
0
 public TycheAgentCompetition(double time)
     : this(TyStateWeights.GetDefault(), true, DEFAULT_NUM_EPISODES_MULTIPLIER, true)
 {
     MAX_TIME = time;
 }
Example #12
0
 public static TycheAgentCompetition GetSearchTreeAgent(int episodeMultiplier)
 {
     return(new TycheAgentCompetition(TyStateWeights.GetDefault(), true, episodeMultiplier, true));
 }
Example #13
0
 public static TycheAgentCompetition GetLearningAgent(TyStateWeights weights)
 {
     return(new TycheAgentCompetition(weights, false, LEARNING_NUM_EPISODES_MULTIPLIER, false));
 }
Example #14
0
 public TyStateAnalyzer(TyStateWeights weights)
 {
     Weights = weights;
 }