示例#1
0
  @Override
  public Pair<Optional<String>, CluedoCharacter> askForNameAndCharacter(
      List<CluedoCharacter> availableCharacters) {
    Stream<String> characterNames = availableCharacters.stream().map(CluedoCharacter::toString);

    this.out.println("Select a character:\n");

    int index = this.selectOptionFromList(characterNames);
    return new Pair<>(Optional.empty(), availableCharacters.get(index));
  }
示例#2
0
  @Override
  public SuggestionResponse requestPlayerResponse(
      Player player, List<SuggestionResponse> possibleResponses) {
    this.out.printf(
        "%s can disprove this suggestion. %s, what do you want to disprove?\n",
        player.character, player.character);

    Stream<String> responseStrings = possibleResponses.stream().map(SuggestionResponse::toString);
    return possibleResponses.get(this.selectOptionFromList(responseStrings));
  }