using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumberWizard : MonoBehaviour
{
int maxGuess;
int minGuess;
int guess;
int replay;
// Start is called before the first frame update
void Start()
{
StartGame();
}
void StartGame()
{
//Debug.Log("Test A");
maxGuess = 1000;
minGuess = 1;
guess = 500;
Debug.Log("Welcome to number Wizard.");
Debug.Log("Choose a number. Don't tell me what it is.");
Debug.Log("The highest option is : " + maxGuess);
Debug.Log("The lowest option is : " + minGuess);
Debug.Log("My guess is " + guess);
Debug.Log("Push up for greater.Push down for less");
Debug.Log("push enter if it is correct");
//Debug.Log("Test B");
Update();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("It is higher than " + guess + ".");
minGuess = guess;
//Debug.Log("Test C");
NextGuess();
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("It is lower than " + guess + ".");
maxGuess = guess;
//Debug.Log("Test D");
NextGuess();
}
else if (Input.GetKeyDown(KeyCode.Return))
{
//Debug.Log("Test G");
Debug.Log("I knew it!");
//Debug.Log("Test E");
/////////////////////////////
//StartGame();///////////////
/////////////////////////////
///
StartGame();
}
void NextGuess()
{
guess = (maxGuess + minGuess) / 2;
Debug.Log("Is it higher or lower than " + guess);
}
/*void restart()
{
maxGuess = 1000;
minGuess = 1;
guess = 500;
Debug.Log("Choose a number. Don't tell me what it is.");
Debug.Log("The highest option is : " + maxGuess);
Debug.Log("The lowest option is : " + minGuess);
Debug.Log("My guess is " + guess);
Debug.Log("Push up for greater.Push down for less");
Debug.Log("push enter if it is correct");
Update();
Debug.Log("No bugs yet");
}*/
}
}