Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created March 23, 2015 21:03
Show Gist options
  • Select an option

  • Save pumpkincouture/37ede2875eaf53d2ee7a to your computer and use it in GitHub Desktop.

Select an option

Save pumpkincouture/37ede2875eaf53d2ee7a to your computer and use it in GitHub Desktop.
public class ParticipantChoice implements Choice {
private CommandLineInterface ui;
private int playerOption;
private ChoiceValidator choiceValidator;
public ParticipantChoice(CommandLineInterface ui) {
this.ui = ui;
}
public List<String> addValidChoices() {
List<String> validChoices = new ArrayList<>();
validChoices.add("1");
validChoices.add("2");
validChoices.add("3");
validChoices.add("4");
return validChoices;
}
public void validatePlayerConfiguration(String gameConfigurationChoice) {
choiceValidator = new ChoiceValidator();
if (choiceValidator.validUserChoice(gameConfigurationChoice, addValidChoices()) == 0) {
getPlayerOption(gameConfigurationChoice);
} else {
playerOption = choiceValidator.validUserChoice(gameConfigurationChoice, addValidChoices());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment