コード例 #1
0
ファイル: Program.cs プロジェクト: UlieS/SabberStone
        private static void Main(string[] args)
        {
            Console.WriteLine("Setup gameConfig");

            //todo: rename to Main
            GameConfig gameConfig = new GameConfig {
                StartPlayer      = 2,
                Player1HeroClass = CardClass.DRUID,
                Player2HeroClass = CardClass.WARLOCK,
                Player1Deck      = Decks.MidrangeJadeShaman,
                Player2Deck      = Decks.RenoKazakusMage,
                FillDecks        = true,
                SkipMulligan     = true,
            };

            Console.WriteLine("Setup POGameHandler");
            AbstractAgent player1     = new RandomAgentLateEnd();
            AbstractAgent player2     = new Gandalf();
            var           gameHandler = new POGameHandler(gameConfig, player1, player2, debug: true);

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

            gameStats.printResults();

            Console.WriteLine("Test successful");
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: screwdycrow/SabberStone
        private static void Main(string[] args)
        {
            Console.WriteLine("Setup gameConfig");

            //todo: rename to Main
            GameConfig gameConfig = new GameConfig
            {
                StartPlayer = 1,

                Logging = true
            };

            gameConfig.Player1Name = "Sky";
            gameConfig.Player2Name = "Net";
            gameConfig.Player1Deck = Decks.RenoKazakusMage;                                                     //My Deck

            Dictionary <string, List <Card> > decksAvailable = new Dictionary <string, List <Card> >();         //set opponents decks.

            decksAvailable.Add("AggroPirateWarrior", Decks.AggroPirateWarrior);                                 //AggroPirateWarrior
            decksAvailable.Add("MidrangeJadeShaman", Decks.MidrangeJadeShaman);                                 //MidrangeJadeShaman
            decksAvailable.Add("RenoKazakusMage", Decks.RenoKazakusMage);                                       //RenoKazakusMage

            Console.WriteLine("Setup POGameHandler");
            AbstractAgent player1 = new src.Agent.MyAgent();
            AbstractAgent player2;

            Console.WriteLine("Start Games ");

            Console.WriteLine("=== MyAgent vs Random Agent=== ");
            player2 = new RandomAgent();                                                                                                                        //play all games against the Random Agent
            Helper.SimulateAllGames(gameConfig, player1, player2, decksAvailable);


            Console.WriteLine("=== MyAgent vs RandomLateEnd Agent ===");

            /* i achieve around  >80 % on one occasions against AggroPirate
             * with this agent and >90% in others, but it was not announced,
             * until 25 june that i had to compete against this as well,
             * so i didn' try to make something better and sophisticated, cause
             * no time.
             */

            //play all games against the RandomLateEnd Agent,
            player2 = new RandomAgentLateEnd();
            Helper.SimulateAllGames(gameConfig, player1, player2, decksAvailable);

            Console.WriteLine("=== My Agent vs FaceHunter Agent ===");                                       //play all games against the RandomLateEnd Agent
            player2 = new FaceHunter();
            Helper.SimulateAllGames(gameConfig, player1, player2, decksAvailable);

            Console.WriteLine("Test Ended");
            Console.ReadLine();
        }
コード例 #3
0
        /// <summary>
        /// Decks to choose from:
        ///		Decks.AggroPirateWarrior
        ///		Decks.RenoKazakusMage
        ///		Decks.MidrangeJadeShaman
        /// Rules:
        ///		- an Agent class that inherist from Abstract Agent
        ///		- supporting files of up to 1GB(please contact us in case you need to load a bigger database or something like an extremely large Neural Network)
        ///		- the agent needs to finish the whole turn with a time limit of 75 seconds.Execution times for returned moves are removed from the time being used by the agent.In case the submitted agent exceeds this limit, it will lose the game.
        ///
        /// </summary>
        /// <param name="args"></param>
        private static void Main(string[] args)
        {
            int numberOfGamesGames = 100;
            int filesToWrite       = 1;
            var Rnd              = new Random();
            var watch            = System.Diagnostics.Stopwatch.StartNew();
            int exceptioncounter = 0;
            int turnsPlayed      = 0;

            for (int k = 0; k < filesToWrite; k++)
            {
                for (int i = 0; i < numberOfGamesGames; i++)
                {
                    //Console.WriteLine("Setup gameConfig");
                    try
                    {
                        GameConfig gameConfig = new GameConfig
                        {
                            StartPlayer      = -1,
                            Player1HeroClass = CardClass.WARRIOR,
                            Player2HeroClass = CardClass.WARRIOR,
                            Player1Deck      = Decks.AggroPirateWarrior,
                            Player2Deck      = Decks.AggroPirateWarrior,
                            Logging          = false
                        };

                        AbstractAgent player1     = new MyAgent(); gameConfig.Player1Name = "Player1";
                        AbstractAgent player2     = new RandomAgentLateEnd(); gameConfig.Player2Name = "Player2";
                        var           gameHandler = new POGameHandler(gameConfig, player1, player2, debug: false);
                        gameHandler.PlayGames(5, true);

                        turnsPlayed += gameHandler.getGameStats().TurnsPlayed;
                    }
                    catch
                    {
                        exceptioncounter++;
                        Console.Write("Ex:" + exceptioncounter + " ");
                        i--;
                    }
                    if (i % 100 == 0 && i != 0)
                    {
                        Console.WriteLine("\t" + watch.Elapsed.TotalMinutes.ToString("F2") + "min \t\tCount:" + i);
                    }
                }
                Console.WriteLine("Done  Turns:" + turnsPlayed);
            }
            Console.ReadLine();
        }