Example #1
0
 @Test
 public final void testEasyVsHard() {
   for (int i = 0; i < 10; i++) {
     try {
       setUp();
       Player aiPlayer1 = TestAccessor.Game.getPlayer1(game);
       AI ai1 = new AI(aiPlayer1, game, false);
       while (game.getWinner() == null) {
         Player currPlayer = TestAccessor.Game.getCurrentPlayer(game);
         if (currPlayer == aiPlayer) ai.doNextMove();
         else ai1.doNextMove();
       }
       //        System.out.println("Winner: " + game.getWinner().name);
     } catch (IllegalMoveException e) {
       e.printStackTrace();
       fail();
     } catch (Exception e) {
       e.printStackTrace();
       fail();
     }
   }
 }
Example #2
0
 @Test
 public final void testGetOpponent() {
   Player player1 = TestAccessor.Game.getPlayer1(game);
   Player opponent = TestAccessor.AI.getOpponent(ai);
   assertEquals(player1, opponent);
 }