public void MCTSSimpleAgentTests_Run_NoChildren()
        {
            AIAgent agent = new MCTSSimpleAgent("DefaultSettings.xml");

            agent.run(new TestAIState("empty"));
            bool aiDone = false;

            while (!aiDone)
            {
                if (agent.done)
                {
                    aiDone = true;
                }
            }
            AIState next = agent.next;

            Assert.True(next == null);
        }
Exemple #2
0
    void Start()
    {
        //Redirect the console output (for debugging purposes).
        UnitySystemConsoleRedirector.Redirect();
        //Make a new agent
        AIAgent agent;
        //And model
        Model model = new Model(GameData.modelFiles [gameIndx]);
        //Set the settings
        string settings = GameData.settingsFiles [gameIndx];

        //And init the right agent with the model and settings above.
        if (GameData.selectedAgent == 0)
        {
            agent = new RandomAgent();
        }
        else if (GameData.selectedAgent == 1)
        {
            agent = new ModelBasedAgent(model);
        }
        else if (GameData.selectedAgent == 2)
        {
            agent = new MCTSSimpleAgent(settings);
        }
        else if (GameData.selectedAgent == 3)
        {
            agent = new MCTSWithPruning(model, settings);
        }
        else if (GameData.selectedAgent == 4)
        {
            agent = new MCTSWithSoftPruning(model, settings);
        }
        else if (GameData.selectedAgent == 5)
        {
            agent = new MCTSWithLearning(model, settings);
        }
        else
        {
            agent = new MCTSSimpleAgent(settings);
        }

        //Init the correct game
        if (gameIndx == 0)
        {
            currentGame = gameObject.AddComponent <TicTacToe> ();
        }
        else if (gameIndx == 1)
        {
            currentGame = gameObject.AddComponent <OrderAndChaos> ();
        }
        else if (gameIndx == 2)
        {
            currentGame = gameObject.AddComponent <Hex> ();
        }

        //Once the game has been made set the rest of the game up
        currentGame.ai         = agent;
        currentGame.playerIndx = GameData.playerIndex;;
        currentGame.preFabTile = preFabTile;
        currentGame.AIThinking = AIThinking;
        currentGame.EndGame    = EndGame;
        currentGame.winlose    = winlose;
    }
        public void MCTSSimpleAgentTests_Init_NullSettings()
        {
            AIAgent agent = new MCTSSimpleAgent(null);

            Assert.True(agent != null);
        }