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-a to the Number Wizard, mamma mia!");
Debug.Log("Pick a number...");
Debug.Log("The highest-a number is: "+ max);
Debug.Log("The lowest-a number is: "+ min);
Debug.Log("Is-a your number higher or lower than" + guess + "?");
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct");
max++;
}
// Update is called once per frame
void Update()
{
//Number higher than guess
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Is it " + guess + "?");
}
//Number lower than guess
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Is it " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Oh, so I guessed-a it right!");
}
}
}