mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +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);
|
||||
try {
|
||||
task.get(Config2.maxThinkSeconds, TimeUnit.SECONDS);
|
||||
task.get(Config2.maxThinkSeconds, TimeUnit.MINUTES);
|
||||
} catch (TimeoutException e) {
|
||||
logger.info("simulating - timed out");
|
||||
task.cancel(true);
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ public class ComputerPlayer5 extends ComputerPlayer4 implements Player {
|
|||
}
|
||||
|
||||
protected void calculatePreCombatActions(Game game) {
|
||||
if (!getNextAction(game)) {
|
||||
//if (!getNextAction(game)) {
|
||||
currentScore = GameStateEvaluator2.evaluate(playerId, game);
|
||||
Game sim = createSimulation(game);
|
||||
SimulationNode2.resetCount();
|
||||
|
@ -184,7 +184,7 @@ public class ComputerPlayer5 extends ComputerPlayer4 implements Player {
|
|||
actions = new LinkedList<Ability>(root.abilities);
|
||||
combat = root.combat;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
protected void calculatePostCombatActions(Game game) {
|
||||
|
@ -406,11 +406,14 @@ public class ComputerPlayer5 extends ComputerPlayer4 implements Player {
|
|||
break;
|
||||
}
|
||||
Game sim = game.copy();
|
||||
for (CombatGroup group: engagement.getGroups()) {
|
||||
UUID attackerId = group.getAttackers().get(0);
|
||||
for (UUID blockerId: group.getBlockers()) {
|
||||
sim.getPlayer(defenderId).declareBlocker(blockerId, attackerId, sim);
|
||||
for (CombatGroup group : engagement.getGroups()) {
|
||||
if (group.getAttackers().size() > 0) {
|
||||
UUID attackerId = group.getAttackers().get(0);
|
||||
for (UUID blockerId : group.getBlockers()) {
|
||||
sim.getPlayer(defenderId).declareBlocker(blockerId, attackerId, sim);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, playerId, playerId));
|
||||
SimulationNode2 newNode = new SimulationNode2(sim, depth, defenderId);
|
||||
|
|
Loading…
Reference in a new issue