Welcome to Number Wizard, my dude!

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 to Number Wizard, my dude!");
    Debug.Log("Go ahead and pick a number!");
    Debug.Log("The highest number you can pick is: " + max);
    Debug.Log("The lowest number you can pick is: " + min);
    Debug.Log("Is your number higher or lower than 500?");
    Debug.Log("Push up = Higher, Push Down = Lower, Enter/Return = Correct!");
    max = max + 1; 
}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        Debug.Log("Your number is higher...");
        min = guess;
        guess = (max + min) / 2;
        Debug.Log("How about " + guess + "?");
    }

    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        Debug.Log("Your number is lower...");
        max = guess;
        guess = (min + max) / 2; 
        Debug.Log("How about " + guess + "?");
    }

    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("Haha! I got it right!");
    }
}

}

Privacy & Terms