using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{
Debug.Log("Welcome!It is I, the fabled Number Wizard!");
Debug.Log("Pick a number, any number! I shall guess whatever it may be!");
Debug.Log("Alas! The highest number you can pick however is: " + max);
Debug.Log("And the lowest number is: " + min);
Debug.Log("Do tell if your number is higher or lower than: " + guess);
Debug.Log("To guess, flex your up [Arrow Up] muscle to guess higher, your [Arrow Down] muscle to guess lower and your [Enter] muscle if my guess is correct.");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Hmm... is it higher or lower than " + guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Hmpf... is is it higher or lower than" + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Huzzah!I did it again! I am the greatest number wizard to ever wizard!");
}
}
}
1 Like
The clickbait title had me laughing. Cant wait to see the UI version!