Customising work is good fun!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour
{
int maxGuess = 1000;
int minGuess = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Please...Enter the lair of the Number Wizard...if you dare...muhahahHAHAHAHA!");
Debug.Log("Dare to choose a number, but DON'T TELL ME...I can read minds my friend");
Debug.Log("...However your chosen number can only be betwixt the realms of " + minGuess);
Debug.Log(" and " + maxGuess);
Debug.Log("Ok young one you have to tell me if your number is higher or lower than" + guess);
Debug.Log("Press the up arrow if it is higher or the down arrow if it is lower, Press Enter = Correct");
maxGuess = maxGuess + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("Hmmmm...It's higher you say? then perhaps it is...");
minGuess = guess;
guess = (maxGuess + minGuess) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Hmmmm...Lower?? Then maybe it is....");
maxGuess = guess;
guess = (maxGuess + minGuess) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Ahaaa, success at last! Now leave young one, or fear the sheer wrath of...the NUMBER WIZARD");
}
}
}