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(The magnificent Wizard of Pierogi welcomes you!");
Debug.Log("Think of a number...");
Debug.Log("The highest number is: " +max);
Debug.Log("The lowest number is: " +min);
Debug.Log("Tell me if your number is higher or lower than " + guess);
Debug.Log("UpArrow = Higher, DownArrow = Lower, Enter = Correct");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("This number is higher than " + guess + "!");
min = guess;
guess = (min + max) / 2;
Debug.Log("So maybe it's " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("This number is lower than " + guess + "!");
max = guess;
guess = (min + max) / 2;
Debug.Log("So maybe it's " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("This is the number you've picked: " + guess + "!");
Debug.Log("Congratulations to me!");
}
}
}