int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Hello Comrade! You're using the Communist Number Wizard Electronic Device-1986(CNWED-86)");
Debug.Log("In order to proceed, pick any number within the limits given below:");
Debug.Log("- The highest number you can pick is: " + max);
Debug.Log("- The lowest number you can pick is: " + min);
Debug.Log("Is your number higher or lower than " + guess + "?");
Debug.Log("Push Up = Higher, Push Down = Lower, Enter = Correct");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Is your number higher or lower than " + guess + "?");
}
else if (Input.GetKeyUp(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Is your number higher or lower than " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("The CNWED-86 has done calculating and the result is " + guess + ".");
}
}
}