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("Hola amigo, welcome to Number Wizard!");
Debug.Log("Pick a number but don't tell me");
Debug.Log("You can't pick a number higher than " + max);
Debug.Log("You can't pick a number lower than " + min);
Debug.Log("Tell me if your number is higher or lower than " + guess);
Debug.Log("Up Key = Higher, Down Key = Lower, Enter Key = Correct");
max = max + 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("Oh, so it's higher, what about now then?");
min = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Mmmh, lower. And now?");
max = guess;
guess = (max + min) / 2;
Debug.Log(guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Excellent, i guessed your number!");
}
}
}