mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Previous comment wasn't full: added error handling. Fixed PlayerImpl, added work around to BoostPowerXSourceEffect. Fixed some bugs in AI.
This commit is contained in:
parent
4b2a9cd203
commit
424ecde6e3
2 changed files with 12 additions and 9 deletions
|
@ -299,14 +299,14 @@ public class ComputerPlayer4 extends ComputerPlayer<ComputerPlayer4> implements
|
||||||
});
|
});
|
||||||
pool.execute(task);
|
pool.execute(task);
|
||||||
try {
|
try {
|
||||||
task.get(Config2.maxThinkSeconds, TimeUnit.SECONDS);
|
task.get(Config2.maxThinkSeconds, TimeUnit.MINUTES);
|
||||||
} catch (TimeoutException e) {
|
} catch (TimeoutException e) {
|
||||||
logger.info("simulating - timed out");
|
logger.info("simulating - timed out");
|
||||||
task.cancel(true);
|
task.cancel(true);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class ComputerPlayer5 extends ComputerPlayer4 implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void calculatePreCombatActions(Game game) {
|
protected void calculatePreCombatActions(Game game) {
|
||||||
if (!getNextAction(game)) {
|
//if (!getNextAction(game)) {
|
||||||
currentScore = GameStateEvaluator2.evaluate(playerId, game);
|
currentScore = GameStateEvaluator2.evaluate(playerId, game);
|
||||||
Game sim = createSimulation(game);
|
Game sim = createSimulation(game);
|
||||||
SimulationNode2.resetCount();
|
SimulationNode2.resetCount();
|
||||||
|
@ -184,7 +184,7 @@ public class ComputerPlayer5 extends ComputerPlayer4 implements Player {
|
||||||
actions = new LinkedList<Ability>(root.abilities);
|
actions = new LinkedList<Ability>(root.abilities);
|
||||||
combat = root.combat;
|
combat = root.combat;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void calculatePostCombatActions(Game game) {
|
protected void calculatePostCombatActions(Game game) {
|
||||||
|
@ -406,11 +406,14 @@ public class ComputerPlayer5 extends ComputerPlayer4 implements Player {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Game sim = game.copy();
|
Game sim = game.copy();
|
||||||
for (CombatGroup group: engagement.getGroups()) {
|
for (CombatGroup group : engagement.getGroups()) {
|
||||||
UUID attackerId = group.getAttackers().get(0);
|
if (group.getAttackers().size() > 0) {
|
||||||
for (UUID blockerId: group.getBlockers()) {
|
UUID attackerId = group.getAttackers().get(0);
|
||||||
sim.getPlayer(defenderId).declareBlocker(blockerId, attackerId, sim);
|
for (UUID blockerId : group.getBlockers()) {
|
||||||
|
sim.getPlayer(defenderId).declareBlocker(blockerId, attackerId, sim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, playerId, playerId));
|
sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, playerId, playerId));
|
||||||
SimulationNode2 newNode = new SimulationNode2(sim, depth, defenderId);
|
SimulationNode2 newNode = new SimulationNode2(sim, depth, defenderId);
|
||||||
|
|
Loading…
Reference in a new issue