Exemplo n.º 1
0
        // MonoRobots.exe --play <relative_ki> <relative_board> <difficulty?>
        private static void PlayGame(String kiPath, String boardPath, Difficulty difficulty)
        {
            RoboManager      roboManager = SetupRoboManager();
            RoboPlayerPlugin roboPlugin  = SetupRoboPlayer(roboManager, kiPath, true);
            RoboBoard        board       = RoboUtils.LoadBoard(boardPath, true, difficulty);

            Console.WriteLine("Start...");

            ExecuteGame(roboManager, board, RoboUtils.CreateCardPile());

            Console.Write(GetResults(roboManager));
            Console.WriteLine("End...");
        }
Exemplo n.º 2
0
        // MonoRobots.exe --stats <relative_ki> <relative_boards> <relative_decks>
        private static void Statistics(String kiPath, String boardsPath, String decksPath, Difficulty difficulty)
        {
            RoboManager roboManager = SetupRoboManager();

            Dictionary <String, Dictionary <String, List <RoboPlayerResult> > > allResults = new Dictionary <String, Dictionary <String, List <RoboPlayerResult> > >();

            int roundsPlayedInTotal = 0;

            foreach (String boardFileName in getFileEnumerable(boardsPath))
            {
                RoboBoard board = RoboUtils.LoadBoard(boardFileName, true, difficulty);
                foreach (String pluginPath in getFileEnumerable(kiPath))
                {
                    RoboPlayerPlugin roboPlugin = SetupRoboPlayer(roboManager, pluginPath, true);

                    Dictionary <String, List <RoboPlayerResult> > boardResults = new Dictionary <String, List <RoboPlayerResult> >();
                    allResults[boardFileName] = boardResults;
                    List <RoboPlayerResult> playerResults = new List <RoboPlayerResult>();
                    boardResults.Add(pluginPath, playerResults);

                    foreach (String deckFileName in getFileEnumerable(decksPath))
                    {
                        RoboCard[] pile = RoboUtils.LoadCardDeck(deckFileName);
                        ExecuteGame(roboManager, board, pile);
                        roundsPlayedInTotal++;

                        RoboPlayerResult singleStat = new RoboPlayerResult(roboPlugin.Player);
                        playerResults.Add(singleStat);
                    }

                    roboManager.DeactivatePlugin(roboPlugin);
                }
            }

            Console.WriteLine("RoundsPlayed: " + roundsPlayedInTotal);
            Console.Write(GetFormattedStatistics(allResults));
        }