use of aima.core.environment.tictactoe.TicTacToeGame in project aima-java by aimacode.
the class TicTacToeDemo method startMinimaxDemo.
private static void startMinimaxDemo() {
System.out.println("MINI MAX DEMO\n");
TicTacToeGame game = new TicTacToeGame();
TicTacToeState currState = game.getInitialState();
AdversarialSearch<TicTacToeState, XYLocation> search = MinimaxSearch.createFor(game);
while (!(game.isTerminal(currState))) {
System.out.println(game.getPlayer(currState) + " playing ... ");
XYLocation action = search.makeDecision(currState);
currState = game.getResult(currState, action);
System.out.println(currState);
}
System.out.println("MINI MAX DEMO done");
}
use of aima.core.environment.tictactoe.TicTacToeGame in project aima-java by aimacode.
the class TicTacToeDemo method startAlphaBetaDemo.
private static void startAlphaBetaDemo() {
System.out.println("ALPHA BETA DEMO\n");
TicTacToeGame game = new TicTacToeGame();
TicTacToeState currState = game.getInitialState();
AdversarialSearch<TicTacToeState, XYLocation> search = AlphaBetaSearch.createFor(game);
while (!(game.isTerminal(currState))) {
System.out.println(game.getPlayer(currState) + " playing ... ");
XYLocation action = search.makeDecision(currState);
currState = game.getResult(currState, action);
System.out.println(currState);
}
System.out.println("ALPHA BETA DEMO done");
}
use of aima.core.environment.tictactoe.TicTacToeGame in project aima-java by aimacode.
the class TicTacToeTest method setUp.
@Before
public void setUp() {
game = new TicTacToeGame();
state = game.getInitialState();
}
use of aima.core.environment.tictactoe.TicTacToeGame in project aima-java by aimacode.
the class TicTacToeTest method testCreation.
@Test
public void testCreation() {
game = new TicTacToeGame();
state = game.getInitialState();
Assert.assertEquals(9, game.getActions(state).size());
Assert.assertEquals(TicTacToeState.X, game.getPlayer(state));
}
use of aima.core.environment.tictactoe.TicTacToeGame in project aima-java by aimacode.
the class TicTacToeApp method initialize.
@Override
public void initialize() {
game = new TicTacToeGame();
currState = game.getInitialState();
searchMetrics = null;
update();
}
Aggregations