void Start()
{
Debug.Log("Welcome Traveler, to The Galactic Number Wizard!");
Debug.Log("The Galaxy wants you to pick a number(it does not have to be 42). I will then guess, in LESS THAN 10 guesses, to see if you are one with the Universe.");
Debug.Log("The rules are simple. The LARGEST number you can choose is " + max);
Debug.Log("The SMALLEST number you can choose is: " + min);
Debug.Log("Let's start. Tell me if your number is higher or lower than... " + max);
Debug.Log("Pushing Up = Higher, Pushing Down = Lower, Pushing Enter = The Guess is Correct");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("Ah, that is interesting I was going to go higher.");
min = guess;
guess = (min + max) / 2;
Debug.Log("Is it Higher or Lower than " + guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Hmmm, guess I was thinking a little to large.");
max = guess;
guess = (min + max) / 2;
Debug.Log("Is "+ guess+ " Higher or Lower than what you are thinking");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("I am correct! The Universe is kind!");
}
1 Like
Really dig your code that…very creative! Happy new year and good luck with your coding journey!
wish you the best
-Rhys