Exemple #1
0
        /// <summary>
        /// Return an action according to an epsilon greedy policy.
        /// Means either best or random.
        /// </summary>
        /// <param name="epsilon">The chance of the action being random</param>
        /// <param name="state"></param>
        protected Actione TakeEpsilonGreedyAction(double epsilon, State state, Random rand)
        {
            Actione action;

            if (rand.NextDouble() <= epsilon)
            {
                action = new Actione(rand.Next(Control.ActionNum));
            }
            else
            {
                action = getMaxAction(Control, state, false);
            }
            Control.DoAction(action);


            return(action);
        }
Exemple #2
0
        /// <summary>
        /// Take the best legal action (according to Bot's policy) in the given game state.
        /// </summary>
        public void TakeAction(GameControlBase control, State state)
        {
            Actione action = getMaxAction(control, state, true);

            control.DoAction(action);
        }