
/**
 * This class serves as a simple ESP tester.  Using this class, the user
 * can repeatedly guess a number and see if it matches the random number 
 * selected by the computer.
 *   @author  Dave Reed
 *   @version 9/9/17
 */

public class ESPTester {
    private Die roller;     // die for picking random values

    /**
     * Constructs an ESPTester that can generate random ints from the range 1..max.
     *   @param max the maximum value in the range (it is assumed that max >= 1)
     */
    public ESPTester(int max) {
        this.roller = new Die(max);
    }

    /**
     * Takes the user's guess and compares it with a randomly selected number.
     *   @param  guess the user's guess (assumed to be in the range 1..maxNumber)
     *   @return a String specifying whether the guess was correct
     */
    public String guessNumber(int guess) {
        int pick = roller.roll();
        
        if (guess == pick) {
            return ("You were correct, my number was " + pick);
        }
        else {
            return ("Sorry, my number was " + pick);
        }
    }
}
