mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Fixed AI test class.
This commit is contained in:
parent
3b61a10237
commit
1cf93e6c43
2 changed files with 18 additions and 2 deletions
|
@ -108,6 +108,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
private int maxCallsWithoutAction = 100;
|
||||
private int foundNoAction = 0;
|
||||
private boolean AIPlayer;
|
||||
|
||||
private final List<PlayerAction> actions = new ArrayList<>();
|
||||
private final List<String> choices = new ArrayList<>();
|
||||
|
@ -119,6 +120,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
public TestPlayer(ComputerPlayer computerPlayer) {
|
||||
this.computerPlayer = computerPlayer;
|
||||
AIPlayer = false;
|
||||
}
|
||||
|
||||
public TestPlayer(final TestPlayer testPlayer) {
|
||||
|
@ -414,7 +416,11 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
computerPlayer.pass(game);
|
||||
if (AIPlayer) {
|
||||
computerPlayer.priority(game);
|
||||
} else {
|
||||
computerPlayer.pass(game);
|
||||
}
|
||||
// check to prevent endless loops
|
||||
if (numberOfActions == actions.size()) {
|
||||
foundNoAction++;
|
||||
|
@ -1809,4 +1815,12 @@ public class TestPlayer implements Player {
|
|||
computerPlayer.pickCard(cards, deck, draft);
|
||||
}
|
||||
|
||||
public void setAIPlayer(boolean AIPlayer) {
|
||||
this.AIPlayer = AIPlayer;
|
||||
}
|
||||
|
||||
public boolean isAIPlayer() {
|
||||
return AIPlayer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,9 @@ public abstract class CardTestPlayerBaseAI extends CardTestPlayerAPIImpl {
|
|||
@Override
|
||||
protected TestPlayer createPlayer(String name) {
|
||||
if (name.equals("PlayerA")) {
|
||||
return new TestPlayer(new ComputerPlayer7("PlayerA", RangeOfInfluence.ONE, skill));
|
||||
TestPlayer testPlayer = new TestPlayer(new ComputerPlayer7("PlayerA", RangeOfInfluence.ONE, skill));
|
||||
testPlayer.setAIPlayer(true);
|
||||
return testPlayer;
|
||||
}
|
||||
return super.createPlayer(name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue