public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("What's up dude, welcome to Number Wizard.");
Debug.Log("Please pick a number.");
Debug.Log("The lowest number you can pick is: " + min);
Debug.Log("The highest number you can pick is: " + max);
Debug.Log("Tell me whether your number is higher or lower than: " + guess );
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct");
max = (max + 1);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
Debug.Log("You have selected: Lower than " + guess);
guess = ((max + min) / 2);
Debug.Log("My new guess is: " + guess);
}
else if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
Debug.Log("You have selected: Higher than " + guess);
guess = ((min + max) / 2);
Debug.Log("My new guess is: " + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Awesome! " + guess + " Was right! I'm always right in the end...");
}
}
}