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("Hey player Welcome to Number Wizard");
Debug.Log("just Pick a Number but don't tell me");
Debug.Log("the Highest number you can pick is: " + max);
Debug.Log("and your Lowest number you can pick is: " + min);
Debug.Log("Tell me if your number is Higher or Lower than: " + guess);
Debug.Log("Push the Up Arrow Key if it is Higher.");
Debug.Log("Push the Down Arrow Key if it is Lower.");
Debug.Log("Push the Return key if it is Correct!");
max = max + 1;
}
// Update is called once per frame
void Update()
{
//If Up arrow is pressed = Number is Higher
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("Is your guess Higher?");
Debug.Log(guess);
}
//If Return is pressed = Guess is Correct
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("My Guess was Correct!");
}
//If Down arrow is pressed = Number is Lower
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("Is your guess Lower?");
Debug.Log(guess);
}
}
}