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);
        }
Example #6
0
        private TycheAgent(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;
        }
Example #7
0
        /// <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 TycheAgent 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 TycheAgent(weights, HERO_BASED_WEIGHTS, 0, ADJUST_EPISODES);

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

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