Search in sources :

Example 1 with IterativeDeepeningAlphaBetaSearch

use of aima.core.search.adversarial.IterativeDeepeningAlphaBetaSearch in project aima-java by aimacode.

the class TicTacToeApp method proposeMove.

/** Uses adversarial search for selecting the next action. */
private void proposeMove() {
    AdversarialSearch<TicTacToeState, XYLocation> search;
    XYLocation action;
    switch(strategyCombo.getSelectionModel().getSelectedIndex()) {
        case 0:
            search = MinimaxSearch.createFor(game);
            break;
        case 1:
            search = AlphaBetaSearch.createFor(game);
            break;
        case 2:
            search = IterativeDeepeningAlphaBetaSearch.createFor(game, 0.0, 1.0, 1000);
            break;
        default:
            search = IterativeDeepeningAlphaBetaSearch.createFor(game, 0.0, 1.0, 1000);
            ((IterativeDeepeningAlphaBetaSearch<?, ?, ?>) search).setLogEnabled(true);
    }
    action = search.makeDecision(currState);
    searchMetrics = search.getMetrics();
    currState = game.getResult(currState, action);
    update();
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) IterativeDeepeningAlphaBetaSearch(aima.core.search.adversarial.IterativeDeepeningAlphaBetaSearch) TicTacToeState(aima.core.environment.tictactoe.TicTacToeState)

Aggregations

TicTacToeState (aima.core.environment.tictactoe.TicTacToeState)1 IterativeDeepeningAlphaBetaSearch (aima.core.search.adversarial.IterativeDeepeningAlphaBetaSearch)1 XYLocation (aima.core.util.datastructure.XYLocation)1