Ejemplo n.º 1
0
        public override void EndGame(EndGameContext context)
        {
            var stateIndex = (int)this.state;
            this.totalGamesCount++;
            this.gamesCount[stateIndex]++;

            if (context.WinnerName == this.Name)
            {
                this.winsCount[stateIndex]++;
            }

            if (this.totalGamesCount % this.stateEvaluationGamesCount == 0)
            {
                this.successRate[stateIndex] =
                    (double)this.winsCount[stateIndex] / this.gamesCount[stateIndex];

                int bestState = 0;
                double bestSuccessRate = 0;
                for (int i = 0; i < this.successRate.Length; i++)
                {
                    if (this.successRate[i] >= bestSuccessRate)
                    {
                        bestState = i;
                        bestSuccessRate = this.successRate[i];
                    }
                }

                this.state = (PlayerStateType)bestState;
            }
        }
Ejemplo n.º 2
0
 public override void EndGame(EndGameContext context)
 {
     /*
     if (context.WinnerName == this.Name)
     {
         GamesWon.PlayerWins++;
     }
     else
     {
         GamesWon.PlayerLosses++;
     }
     GamesWon.TotalGames++;*/
     base.EndGame(context);
 }
Ejemplo n.º 3
0
 public virtual void EndGame(EndGameContext context)
 {
 }
 public override void EndGame(EndGameContext context)
 {
     ExecuteWithTimeLimit(TimeSpan.FromMilliseconds(50), () => base.EndGame(context));
 }
Ejemplo n.º 5
0
 public virtual void EndGame(EndGameContext context)
 {
 }
Ejemplo n.º 6
0
        /// <summary>
        /// The method gathers statistical information about the given AI vs AI battle.
        /// </summary>
        /// <param name="context">The current context of the game.</param>
        public override void EndGame(EndGameContext context)
        {
            if (context.WinnerName == this.Name)
            {
                GamesStatistics.Instance().PlayerWins++;
            }
            else
            {
                GamesStatistics.Instance().PlayerLosses++;
            }

            GamesStatistics.Instance().TotalGames++;

            if (GamesStatistics.Instance().TotalGames % 70 == 0)
            {
                this.strategy.ReEvaluateGameStrategy();
            }

            base.EndGame(context);
        }
Ejemplo n.º 7
0
        public override void EndGame(EndGameContext context)
        {
            this.CurrentName = "NimoaPlayer_" + Guid.NewGuid();
            base.EndGame(context);

            if (context.WinnerName == this.Name)
            {
                this.victories++;
            }
            else
            {
                this.defeats++;
            }
        }
 public override void EndGame(EndGameContext context)
 {
     //TODO : save statistic
 }