예제 #1
0
 /**
  * Takes the user input and returns as a PegArray
  *
  * @return The inputter PegArray
  */
 private PegArray getUserGuess() {
   // Setup the guess array and the char to read from user
   PegArray guess = new PegArray();
   char read = '0';
   // Cycle through the Array
   for (int ind = 0; ind < 4; ind++) {
     // Make sure to take only valid input
     if (read == '0') {
       read =
           Prompt.getString("\tEnter your guess for Peg number " + ind + " (A, B, C, D, E, F)")
               .charAt(0);
       // Set the peg with the new character
       guess.getPeg(ind).setLetter(read);
     }
     read = '0';
   }
   return guess;
 }