mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
AI: fixed computer's errors if all players quit the game;
This commit is contained in:
parent
d41ccd11bc
commit
c1db466d05
4 changed files with 16 additions and 4 deletions
|
|
@ -34,7 +34,11 @@ public class ActionSimulator {
|
|||
}
|
||||
|
||||
public int evaluateState() {
|
||||
Player opponent = game.getPlayer(game.getOpponents(player.getId()).iterator().next());
|
||||
Player opponent = game.getPlayer(game.getOpponents(player.getId()).stream().findFirst().orElse(null));
|
||||
if (opponent == null) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
if (game.checkIfGameIsOver()) {
|
||||
if (player.hasLost() || opponent.hasWon()) {
|
||||
return Integer.MIN_VALUE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue