Example #1
0
  @Override
  public void displayStartingInstructions() {

    displayInstructions(
        "\n"
            + "Welcome to Mastermind.\n"
            + "\n"
            + "This is a text version of the classic board game Mastermind.\n"
            + "The computer will think of a secret code.\n"
            + "The code consists of "
            + numberOfPegs.getNumberOfPegs()
            + " colored pegs.\n"
            + "The pegs may be one of "
            + pegColour.getLength()
            + " colors: "
            + pegColour.getColours().toString()
            + " \n"
            + "A color may appear more than once in the code.\n"
            + "\n"
            + "You try to guess what colored pegs are in the code and what order they are in\n"
            + "After making a guess the result will be displayed.\n"
            + "A result consists of a black peg for each peg you have exactly correct (color and position) in your guess.\n"
            + "For each peg in the guess that is the correct color, but is out of position, you get a white peg.\n"
            + "\n"
            + "Only the first letter of the color is displayed. B for Blue, R for Red, and so forth.\n"
            + "When entering guesses you only need to enter the first character of the color as a capital letter.\n"
            + "\n"
            + "You have "
            + numberOfGuesses.getNumberOfGuesses()
            + " tries to guess the answer or you lose the game.\n");
  }
Example #2
0
 @Override
 public void displayResults(List guesses, List results) {
   displayInstructions("\n" + ".... Secret Code");
   int j = guesses.size();
   int numberGuesses = numberOfGuesses.getNumberOfGuesses();
   displayResultsLine(guesses, results);
   IntStream.range(j, numberGuesses).forEach(i -> displayInstructions("...."));
 }