Blockquotepublic class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Hello and welcome to my little game!");
Debug.Log("Please pick a number! Don't tell it to nobody! Keep it for your self.");
Debug.Log("The highest number you can pick is:" + max);
Debug.Log("Lowest number you can pick is:" + min);
Debug.Log("Tell me if your number is higher or lower than " + guess);
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct");
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess + 1;
guess = (max + min) / 2;
Debug.Log("Hmm higher? Ok let's to try again then..." + guess);
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Lower? How is that possible? Next try..." + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Ohh Yeah! I'm Genius!");
}
}
}