public class NumberWizard : MonoBehaviour
{
int min = 1;
int max = 1000;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Knock knock!");
Debug.Log("Who's here? A number!");
Debug.Log("Which number?? Well you tell me!");
Debug.Log("Highest: " + max);
Debug.Log("Lowest: " + min);
Debug.Log("Tell me if your number is higher or lower than 500");
Debug.Log("Up = Higher, Down = Lower, Enter = Correct Number");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("hm?");
min = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("hmm?");
max = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("AHA!");
}
}
}