using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour {
int max = 1000;
int min = 1;
int guess = 500;
// Use this for initialization
void Start () {
Debug.Log("Welcome to Gnome Guess 3000!");
Debug.Log("Gnomes love number guessing games, makes then produce golden coins everytime they guess right! Enter a number for them to guess to make them happy and me rich!!!");
Debug.Log("The number you input can be no more than 1000 anything higher confuses the gnomes I have trapped....uhhhh...employ and pay handsomely!!! nothing more than: " + max);
Debug.Log("Also avoid the number 0, it causes them to go haywire,stop producing coins and ruins my money! start with: " + min );
Debug.Log("The gnomes want me to ask you if your number is higher or lower than: " + guess);
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct");
max = max + 1;
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("The Gnome king wants to know if your number is higher or lower than " + guess);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("The Gnome Queen wants to know if your number is lower or higher than " + guess);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Generating coins and your answer.");
}
}
}
2 Likes