Guessing Game
Let's play a guessing game!
Complete a method named getSecretValue
which is passed an instance of a Secret
.
The Secret
class provides a single method guess
which accepts an int
parameter.
It returns true
if you have guessed the secret value, and false
otherwise.
assert
that the passed Secret
is not null
.
Write code to determine the secret value between 0 and 31, inclusive.
If the secret does not fall in that range, you should return -1
.
However, note that the Secret
class will fail if you guess again after you have already guessed the secret value!
So as soon as you find the secret, your code should return it and not guess again.
Additional guesses will cause your submission to be marked as incorrect.