Challenge - We Are Coming Close!

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

public class NumberWzard : MonoBehaviour {

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

    // Use this for initialization
    void Start ()
{
       
        Debug.Log("Namaste Player - Apka Number Wizard Mei Swagat Hai");
        Debug.Log("Pick a Number");
        Debug.Log("The Highest Number you can Pick is "+max);
        Debug.Log("The Lowest Number  you can Pick is" + min);
        Debug.Log("Tell me that if the Number is Higher Lower than :" +guess);
        Debug.Log("Push Up = Higher , Push Down = Lower , Push Enter = Correct ");
        max = max + 1;
}
	
	// Update is called once per frame
	void Update ()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {          
            min = guess;
            guess = (min + max) / 2;
            Debug.Log("Is the Number Higher or Lower than :"+guess);
            Debug.Log(guess);
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            max = guess;
            guess = (min + max) / 2;
            Debug.Log("Is the Number Higher or Lower than :" + guess);
            Debug.Log(guess);
        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
           Debug.Log("YAY! I Guessed it Correctly !");
        }
    }
        
}

Privacy & Terms