Number Wizard!

Here’s my take on number wizard after finishing Calculate Guess Variable!

{
int max = 1000;
int min = 1;
int guess = 500;

// Start is called before the first frame update
void Start()
{
    
    Debug.Log("Observe mortal, the power of the Number Wizard stands before you!");
    Debug.Log("Pick a number!");
    Debug.Log("Highest number is; " + max + ".");
    Debug.Log("Lowest number is: " + min + ".");
    Debug.Log("Tell me if your number is higher or lower than " + guess);
    Debug.Log("Push up for Higher, push down for Lower, and press Enter for Correct");
    max = max + 1;
    
}

// Update is called once per frame
void Update()
{
    
    

    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        Debug.Log("The Wizard can sense your number is higher.");
        min = guess;
        guess = (max + min) / 2;
        Debug.Log(guess);
       
    }
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        Debug.Log("The Wizard can sense your number is lower.");
        max = guess;
        guess = (max + min) / 2;
        Debug.Log(guess);
    }
    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("The Number Wizard triumphs again!!");
    }

}

}

2 Likes

Fantastic job :tada:

Looks kind of amazing! :slight_smile:
You use wizard theme, I use tv show wizard theme! :smiley:
But yeah, nice job! :slight_smile:

Privacy & Terms