mirror of
https://github.com/correl/mage.git
synced 2025-04-13 09:11:06 -09:00
Fixed AI test class.
This commit is contained in:
parent
3b61a10237
commit
1cf93e6c43
2 changed files with 18 additions and 2 deletions
Mage.Tests/src/test/java/org/mage/test
|
@ -108,6 +108,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
private int maxCallsWithoutAction = 100;
|
private int maxCallsWithoutAction = 100;
|
||||||
private int foundNoAction = 0;
|
private int foundNoAction = 0;
|
||||||
|
private boolean AIPlayer;
|
||||||
|
|
||||||
private final List<PlayerAction> actions = new ArrayList<>();
|
private final List<PlayerAction> actions = new ArrayList<>();
|
||||||
private final List<String> choices = new ArrayList<>();
|
private final List<String> choices = new ArrayList<>();
|
||||||
|
@ -119,6 +120,7 @@ public class TestPlayer implements Player {
|
||||||
|
|
||||||
public TestPlayer(ComputerPlayer computerPlayer) {
|
public TestPlayer(ComputerPlayer computerPlayer) {
|
||||||
this.computerPlayer = computerPlayer;
|
this.computerPlayer = computerPlayer;
|
||||||
|
AIPlayer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlayer(final TestPlayer testPlayer) {
|
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
|
// check to prevent endless loops
|
||||||
if (numberOfActions == actions.size()) {
|
if (numberOfActions == actions.size()) {
|
||||||
foundNoAction++;
|
foundNoAction++;
|
||||||
|
@ -1809,4 +1815,12 @@ public class TestPlayer implements Player {
|
||||||
computerPlayer.pickCard(cards, deck, draft);
|
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
|
@Override
|
||||||
protected TestPlayer createPlayer(String name) {
|
protected TestPlayer createPlayer(String name) {
|
||||||
if (name.equals("PlayerA")) {
|
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);
|
return super.createPlayer(name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue