mirror of
https://github.com/correl/mage.git
synced 2025-03-27 01:11:43 -09:00
Fixed AI infinite loop on wrong answers input (tests affected)
This commit is contained in:
parent
401146f65f
commit
3d53d28f5e
3 changed files with 9 additions and 3 deletions
Mage.Server.Plugins
Mage.Player.AI.MA/src/mage/player/ai
Mage.Player.AIMinimax/src/mage/player/ai
Mage.Tests/src/test/java/org/mage/test/player
|
@ -767,7 +767,9 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
return super.choose(outcome, choice, game);
|
||||
}
|
||||
if (!choice.isChosen()) {
|
||||
return choice.setChoiceByAnswers(choices, true);
|
||||
if(!choice.setChoiceByAnswers(choices, true)){
|
||||
choice.setRandomChoice();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -478,7 +478,9 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
}
|
||||
|
||||
if (!choice.isChosen()) {
|
||||
return choice.setChoiceByAnswers(choices, true);
|
||||
if(!choice.setChoiceByAnswers(choices, true)){
|
||||
choice.setRandomChoice();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -740,7 +740,9 @@ public class TestPlayer implements Player {
|
|||
@Override
|
||||
public boolean choose(Outcome outcome, Choice choice, Game game) {
|
||||
if (!choices.isEmpty()) {
|
||||
return choice.setChoiceByAnswers(choices, true);
|
||||
if(choice.setChoiceByAnswers(choices, true)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return computerPlayer.choose(outcome, choice, game);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue