Exemplo n.º 1
0
        // check the best normal deck
        public static double Benchmark2(double[] X)
        {
            SetCoef(X);

            List <List <Card> > decks = MyDecks.Instance().GetMyDecks();
            List <CardClass>    heros = MyDecks.Instance().GetMyHeros();



            for (int i = 40; i < 60; i++)
            {
                for (int j = 0; j < decks.Count; j++)
                {
                    //todo: rename to Main
                    GameConfig gameConfig = new GameConfig
                    {
                        StartPlayer      = 1,
                        Player1HeroClass = heros[i],
                        Player2HeroClass = heros[j],
                        FillDecks        = false,
                        Logging          = false,
                        Player1Deck      = decks[i],
                        Player2Deck      = decks[j]
                    };

                    //Console.WriteLine("Setup POGameHandler");
                    AbstractAgent player1     = new UCTHunter();
                    AbstractAgent player2     = new UCTHunter();
                    var           gameHandler = new POGameHandler(gameConfig, player1, player2, debug: false);

                    //Console.WriteLine("PlayGame");
                    gameHandler.PlayGames(3);
                    GameStats gameStats = gameHandler.getGameStats();

                    gameStats.printResults();

                    double winRate = (double)gameStats.PlayerA_Wins / (double)gameStats.GamesPlayed;

                    Log.Instance("coef3.txt").Append(heros[i].ToString() + " " + i.ToString() + ":" + heros[j].ToString() + " " + winRate.ToString());

                    //double expectedMin = 1;

                    //return Math.Pow(winRate - expectedMin, 2);
                }
            }


            return(0.0);
        }
 public void ResetDeckDatas()
 {
     MyDecks.Reset();
 }