Guessing Game

Geoffrey Challen // 2021.9.0

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. You can either require that the passed Secret is not null or mark the parameter as non-nullable.

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.