mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00: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
|
@ -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…
Reference in a new issue