Пример #1
0
 /** Uses adversarial search for selecting the next action. */
 private void proposeMove() {
   Integer action;
   int time = (timeCombo.getSelectedIndex() + 1) * 5;
   AdversarialSearch<ConnectFourState, Integer> search;
   switch (strategyCombo.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, time);
       break;
     case 3:
       search = new ConnectFourAIPlayer(game, time);
       break;
     default:
       search = new ConnectFourAIPlayer(game, time);
       ((ConnectFourAIPlayer) search).setLogEnabled(true);
   }
   action = search.makeDecision(currState);
   searchMetrics = search.getMetrics();
   currState = game.getResult(currState, action);
 }