using UnityEngine;
public class NumberWizard1 : MonoBehaviour
{
int minGuesses = 1;
int maxGuesses = 1000;
int guess = 500;
// Use this for initialization
private void Start()
{
Debug.Log("The number wizard greeteth you");
Debug.Log("The wizard requests a number");
Debug.Log("The wizard prods your mind");
Debug.Log("Your mind has a number between " + minGuesses + " and above " + maxGuesses);
Debug.Log("The wizard will now start his spell");
Debug.Log("The wizard wonders if your number is smaller or larger than 500");
Debug.Log("The wizard's magic says you will press up if it is larger and down if it is smaller.");
maxGuesses = maxGuesses + 1;
}
// Update is called once per frame
private void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("The wizard knew you would press Up.");
minGuesses = guess;
guess = (maxGuesses + minGuesses) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("The wizard knew you would press Down.");
maxGuesses = guess;
guess = (maxGuesses + minGuesses) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("The wizard knew you would press Enter.");
}
}
}