Greetings from Turkey

public class NumberWizard : MonoBehaviour {

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

    // Use this for initialization
    void Start () {
        

        Debug.Log("Merhaba Gardaşım, I'm a magician and will find the number you're thinking.");
        Debug.Log("Pick a number");
        Debug.Log("The highest number you can choose is: " + max);
        Debug.Log("The lowest number you can choose is: " + min);
        Debug.Log("Is your number: " + guess);
        Debug.Log("If it is, press ENTER, if lower than " + guess + " press DOWN ARROW KEY, and if higher 
                            than " + guess + " press UP ARROW KEY");
        max++;
	}
	
	// Update is called once per frame
	void Update () {

        if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("You see? I told you that I could find it.");
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Debug.Log("Ugh, let me try again.");
            min = guess;
            guess = (max + min) / 2;
            Debug.Log("Is you number: " + guess);
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Debug.Log("Ugh, let me try again.");
            max = guess;
            guess = (max + min) / 2;
            Debug.Log("IS your number: " + guess);
        }
        
    }
}

Privacy & Terms