Here my Number Wizard updated Text

Maybe it has wrong grammar or pronunciations.
Sorry about that.
English isn’t my first language

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NumberWizard : MonoBehaviour
{
    int highestNumber = 1000;
    int lowestNumber = 1;
    int guessNumber = 500;

    // Start is called before the first frame update
    void Start()
    {

        Debug.Log("Welcome to the number Wizard, lad!");
        Debug.Log("Please pick a number, don't tell me what is it...?");
        Debug.Log("The highest Number you can pick is: " + highestNumber);
        Debug.Log("The lowest Number you can pick is: " + lowestNumber);
        Debug.Log("Tell me if your number is lower or higher than 500");
        Debug.Log("Push Up Arrow = Higher, Push Down Arrow = Lower, Push Enter = Correct");
        highestNumber = highestNumber + 1;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Debug.Log("Higher than your expectation.");
            lowestNumber = guessNumber;
            guessNumber = (highestNumber + lowestNumber) / 2;
            Debug.Log("How about this: " + guessNumber);
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Debug.Log("Lower than your expectation.");
            highestNumber = guessNumber;
            guessNumber = (highestNumber + lowestNumber) / 2;
            Debug.Log("How about this: " + guessNumber);
        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("Yeah, I know i am a genius.");
        }
    }
}

1 Like

Good job :+1:

Thanks

Privacy & Terms