Greetings from Nova Scotia, Canada

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

public class NumberWizard : MonoBehaviour {

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

    // Use this for initialization
    void Start () {

        Debug.Log("Welcome to Number Wizard, eh!");
        Debug.Log("Pick a number, don't tell me what it is...");
        Debug.Log("Higher Number you can pick is " + max);
        Debug.Log("Lowest Number you can pick is " + min);
        Debug.Log("Tell me if you number if your number is higher or 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))
        { 
            Debug.Log("Higher");
            min = guess;
            guess = (max + min) / 2;
            Debug.Log("Is it " + guess + "?");
        }

        else if (Input.GetKeyDown(KeyCode.DownArrow))
        { 
            Debug.Log("Lower");
            max = guess;
            guess = (max + min) / 2;
            Debug.Log("Is it " + guess + "?");
        }

        else if (Input.GetKeyDown(KeyCode.Return))
        { 
            Debug.Log("Ah ha, I got it!");
        }
    }
}
1 Like

Love the “eh” reference. Will you also throw in “sorry” and “moose” for good measure :wink:

1 Like

Privacy & Terms