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 my dear friend, it's - a me, NUMER O', the best Italian Number Wizard...");
Debug.Log("Pick a number, AMICO MIO, and don't tell me what it is...");
Debug.Log("The highest number you can choose is: " +max);
Debug.Log("The lowest number you can choose is: " +min);
Debug.Log("Tell me if the chosen number is higher or lower than: " +guess);
Debug.Log("Push the Up key if your number Higher than my guess, Push Down if it's Lower, Push Enter if I guessed it right");
Debug.Log("ARRIVEDERCI");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("ACCIDENTI! My guess was too low");
min = guess;
guess = (min + max) / 2;
Debug.Log("How about this? " +guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("MAMMAMIA! My guess was too high");
max = guess;
guess = (min + max) / 2;
Debug.Log("Is it " +guess +"?");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("I told you I was the best, GRAZIE!");
}
}
}