Ejemplo n.º 1
0
        public void testAlphaBetaDecision()
        {
            AlphaBetaSearch <TicTacToeState, XYLocation, string> search = AlphaBetaSearch <TicTacToeState, XYLocation, string> .createFor(game);

            search.makeDecision(state);
            int expandedNodes = search.getMetrics().getInt(MinimaxSearch <TicTacToeState, XYLocation, string> .METRICS_NODES_EXPANDED);

            Assert.AreEqual(30709, expandedNodes);
        }
Ejemplo n.º 2
0
    private void Start()
    {
        Nim game = new Nim(Matches);
        MinimaxSearch <NimState, int, int> minimaxSearch = MinimaxSearch <NimState, int, int> .createFor(game);

        AlphaBetaSearch <NimState, int, int> alphabetaSearch = AlphaBetaSearch <NimState, int, int> .createFor(game);

        NimState state   = game.getInitialState();
        int      action1 = -1;
        int      action2 = -1;

        action1 = minimaxSearch.makeDecision(state);
        action2 = alphabetaSearch.makeDecision(state);

        Debug.Log("Chosen action is " + action1 + " and node minimax " + minimaxSearch.getMetrics());
        Debug.Log("Chosen action is " + action2 + " and node alphabeta " + alphabetaSearch.getMetrics());
    }
Ejemplo n.º 3
0
    private void Start()
    {
        TTT game = new TTT();
        MinimaxSearch <StateTTT, int, int> minimaxSearch = MinimaxSearch <StateTTT, int, int> .createFor(game);

        AlphaBetaSearch <StateTTT, int, int> alphabetaSearch = AlphaBetaSearch <StateTTT, int, int> .createFor(game);

        StateTTT state = game.getInitialState();

        int action1 = -100000;
        int action2 = -100000;

        action1 = minimaxSearch.makeDecision(state);
        action2 = alphabetaSearch.makeDecision(state);

        Debug.Log("Chosen action is " + action1 + " and node minimax " + minimaxSearch.getMetrics());
        Debug.Log("Chosen action is " + action2 + " and node alphabeta " + alphabetaSearch.getMetrics());
    }