Use new AI for computer players
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@448 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
a07e723242
commit
47bf19036e
5 changed files with 220 additions and 192 deletions
|
@ -22,7 +22,7 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
/** */
|
||||
public class BaseAIControlTest {
|
||||
public class AIControlTest {
|
||||
ITurnControl aiControl;
|
||||
|
||||
GameSettings gameSettings;
|
||||
|
@ -38,6 +38,7 @@ public class BaseAIControlTest {
|
|||
@Before
|
||||
public void setUp() {
|
||||
aiControl = TurnControlFactory.getFactory(Type.COMPUTER).create();
|
||||
((AIControl)aiControl).useBackgroundThread = false;
|
||||
gameSettings = new GameSettings();
|
||||
playerSettings = new PlayerSettings("ROBOT_01", Color.GRAY);
|
||||
player = new Player(playerSettings);
|
||||
|
@ -74,14 +75,12 @@ public class BaseAIControlTest {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
@Test(timeout = 10000)
|
||||
public void testTurnZeroRedealing() throws InterruptedException {
|
||||
public void testTurnZeroNoRedealing() throws InterruptedException {
|
||||
aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(),
|
||||
player.getLaidOut(), TurnMode.MAY_REDEAL), gameSettings, view);
|
||||
aiControl.startTurn();
|
||||
while (!redealt) {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertFalse(turnEnded);
|
||||
assertTrue(turnEnded);
|
||||
assertFalse(redealt);
|
||||
assertEquals(table.getSize(), 0);
|
||||
}
|
||||
|
||||
|
@ -95,9 +94,7 @@ public class BaseAIControlTest {
|
|||
player.getLaidOut(), TurnMode.INSPECT_ONLY),
|
||||
gameSettings, view);
|
||||
aiControl.startTurn();
|
||||
while (!turnEnded) {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertTrue(turnEnded);
|
||||
assertFalse(redealt);
|
||||
assertEquals(table.getSize(), 0);
|
||||
}
|
||||
|
@ -110,9 +107,7 @@ public class BaseAIControlTest {
|
|||
aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(),
|
||||
player.getLaidOut(), TurnMode.NORMAL_TURN), gameSettings, view);
|
||||
aiControl.startTurn();
|
||||
while (!turnEnded) {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertTrue(turnEnded);
|
||||
assertFalse(redealt);
|
||||
assertEquals(table.getSize(), 1);
|
||||
assertEquals(player.getHand().getSize(), 0);
|
Reference in a new issue