Hello all! Here’s my code below:
Debug.Log(“Sup? Welcome to Number Wizard.”);
Debug.Log(“Let’s play a little game, yeah? How about you pick a number but do me favor? Keep it to yourself.”);
Debug.Log("The highest number we’re gonna let you pick is: " + max + “.”);
Debug.Log("The lowest number is just gonna be an easy: " + min + “.”);
Debug.Log("Tell me now… Is your number higher or lower than: " + guess + “?”);
Debug.Log(“Here some commands for ya. Push Up = Higher, Push Down = Lower, Push Enter = Correct”);
max = max + 1;
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("So you're saying it's higher than that.");
min = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Oh, so we're gonna go low.");
max = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Looks like you should've picked a harder number.");