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("Ciao!");
Debug.Log("I'm going to challenge your mind");
Debug.Log("You're going to think a number between " + min + " and " + max + " and I'm going to guess it");
Debug.Log("Don't worry how I'll do it.. I'm a wonder of nature!");
Debug.Log("Now...Let's start!");
Debug.Log("my guess is..." + guess);
Debug.Log("If your number is Higher than " + guess + " press UP, if it's lower press DOWN and if it's correct press ENTER");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Ok then... my new guess is: " + guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Ok then... my new guess is: " + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("I'm just that awesome!");
}
}
}