mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +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);
|
return super.choose(outcome, choice, game);
|
||||||
}
|
}
|
||||||
if (!choice.isChosen()) {
|
if (!choice.isChosen()) {
|
||||||
return choice.setChoiceByAnswers(choices, true);
|
if(!choice.setChoiceByAnswers(choices, true)){
|
||||||
|
choice.setRandomChoice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,7 +478,9 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!choice.isChosen()) {
|
if (!choice.isChosen()) {
|
||||||
return choice.setChoiceByAnswers(choices, true);
|
if(!choice.setChoiceByAnswers(choices, true)){
|
||||||
|
choice.setRandomChoice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -740,7 +740,9 @@ public class TestPlayer implements Player {
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, Choice choice, Game game) {
|
public boolean choose(Outcome outcome, Choice choice, Game game) {
|
||||||
if (!choices.isEmpty()) {
|
if (!choices.isEmpty()) {
|
||||||
return choice.setChoiceByAnswers(choices, true);
|
if(choice.setChoiceByAnswers(choices, true)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return computerPlayer.choose(outcome, choice, game);
|
return computerPlayer.choose(outcome, choice, game);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue