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("Yo yo yo, welcome to Number Wizard my bro!");
Debug.Log("Choose any number and I will guess it.");
Debug.Log("First, pick a number between " + max + " and " + min);
Debug.Log("Now, tell me if your number is higher or lower than " + guess);
Debug.Log("If your number is higher, push Up, if your number is lower, push Down, and if I've guessed it, press Enter");
max = max + 1;
}
// Update is called once per frame
void Update() {
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("Your number must be higher than " + guess);
min = guess;
guess = (max + min) / 2;
Debug.Log("Is your number higher or lower than" + guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("Your number must be lower than " + guess);
max = guess;
guess = (max + min) / 2;
Debug.Log("Is your number higher or lower than" + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log( guess + " is Correct!");
}
}
}
This is my Number Wizard Welcome