rick told me to
public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
bool start = true;
// Start is called before the first frame update
void Start()
{
Debug.Log("Welcome, you pathetic human being, you shall now bow to the powers of THE MIGHTY NUMBER WIZARD!");
Debug.Log("You shall now pick a number;");
Debug.Log("And that number shall be somewhere in between " + min + " and " +max +";");
Debug.Log("Press 'Y' when you're ready");
max++;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Y))
{
if (start == true)
{
Debug.Log("I think it´s " + guess);
Debug.Log("Use the up arrow key to say it's a higher number, use the down arrow key to say it's a lower number, and use enter to say im ******** amazing and guessed your number.");
start = false;
}
}
if (Input.GetKeyDown(KeyCode.R))
{
start = true;
min = 1;
max = 1000;
guess = 500;
Debug.Log("Welcome to Number Wizard;");
Debug.Log("You shall now pick a number;");
Debug.Log("And that number shall be somewhere in between " + min + " and " + max + ";");
Debug.Log("Press 'Y' when you're ready");
max++;
}
if (start == false)
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (min + max) / 2;
Debug.Log("I think it´s " + guess);
Debug.Log("(keep going)");
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (min + max) / 2;
Debug.Log("I think it´s " + guess);
Debug.Log("(keep going)");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("HA HA, I knew it was " + guess);
Debug.Log("Press 'R' to restart.");
}
}
}
}