Brrr, Stay Warm Playing Number Wizard

void Start()
{
Debug.Log(“Brrr, Stay Warm Playing Number Wizard”);
Debug.Log(“Pick a Number, but don’t tell me so I can guess it”);
Debug.Log("Highest Number is: " + max);
Debug.Log("Lowest Number is: " + min);
Debug.Log("Tell me if your number is higher or lower than my guess: " + guess);
Debug.Log(“Press the Up Arrow = Higher, Press Down Arrow = Lower, Press Enter if I am Correct”);
max = max + 1;
}

// Update is called once per frame
void Update()
{
    //Detect when the up arrow key is pressed down
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        Debug.Log("You picked higher than " + guess);
        min = guess;
        guess = (max + min) / 2;
        Debug.Log("My new guess is " + guess);
    }
    //Detect when the down arrow key is pressed down
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        Debug.Log("You picked lower than " + guess);
        max = guess;
        guess = (max + min) / 2;
        Debug.Log("My new guess is " + guess);
    }
    //Detect when the Return key is pressed down
    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("Hah, I guessed your number correctly!!!");
    }
2 Likes

Awesome looking code! :fire:

Privacy & Terms