The Challenge of the wizard


    // Use this for initialization
    void Start () 
	{
    	Debug.Log ("Welcome to number Wizard insect"); 
		Debug.Log ("Pick a number, even tho I will know what it is.");
		Debug.Log ("The highest number you can pick is: " + max );
		Debug.Log ("The lowest number you can pick is: " + min );
		Debug.Log ("Tell me if your number is higher or lower than 500");
		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))
		{
			Debug.Log("I bet it's higher.");
            min = guess;
            guess = (min + max) / 2;
            Debug.Log(guess);
		}
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Debug.Log("I bet it's lower.");
            max = guess;
            guess = (max + min) / 2;
            Debug.Log(guess);
        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("Restarted");
        }
    }
}

Privacy & Terms