public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Use this for initialization
void Start ()
{
Debug.Log("Let me introduce myself. I am The Oracle Star-Nosed Mole and I can READ YOUR MIND.");
Debug.Log("To prove my amazing, magical abilities, proceed to pick any number between " + min + " and " + max + ", Shhhh! Don't tell me what it is, STUPID.");
Debug.Log("Okay, got one? Now give me a minute while I activate my oracle powers. ACTIVATING POWERRRRRRSS");
Debug.Log("YOUR NUMBER IS ... " + guess + "! Hit Enter now to bow down to me and my amazing abilities!");
Debug.Log("Now, of course you may have utilised some sort of crazy witchcraft to block my miraculous powers.");
Debug.Log("In this case SHAME ON YOU but I will need the opportunity for just 1 more divination. Tell me if your number is higher or lower than " + guess +" by using the up and down button on your keyboard.");
max = max + 1;
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("WHAT?!? Your number is not " + guess + "??! Your black magic is strong.");
min = guess;
guess = (max + min) / 2;
Debug.Log("Okay, your number is " + guess + "!");
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Errr, ummm this has never happened to me before. I just need one more divination");
max = guess;
guess = (max + min) / 2;
Debug.Log("Okay, your number is " + guess + "!");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("All hail the Oracle Star-Nosed Mole and his all-knowing magical abilities!");
}
}
}
1 Like