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("Welcome to Guess a number! You are in luck!");
Debug.Log("First ladies and gents, we need you to pick a number between 1 and 1000!");
Debug.Log("Here it is gentleman the highest number!: " + max);
Debug.Log("Low, low number here: " + min);
Debug.Log("Is it higher than five hundred folks! Take your chances win a prize!");
Debug.Log("When you press up the number goes up, when you press down the number goes down!");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("BANG! You must think it's a higher number");
min = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Boom! You must think it's a lower number.");
max = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Return key was pressed");
}
}
}