﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class NumberWizard : MonoBehaviour {

	int min = 1;
	int max = 1000;
	int guess = 500;

	public Text guessText; 

	// Use this for initialization
	void Start () {
		min = 1;
		max = 1000;
		
		StartGame();
		
	}
	
	void StartGame() {
		max = max + 1;
		NextGuess ();									
	}
	
	public void GuessHigher() 
	{
		min = guess;
		NextGuess();	
	}
	
	public void GuessLower() 
	{
		max = guess;
		NextGuess();	
	}

	public void GuessCorrect()
	{
		//print ("I won!");
		StartGame ();		
	}
		
				
	void NextGuess()
	{
		//guess = (max + min) / 2;
		guess = Random.Range(min, max);
		
		guessText.text = guess.ToString();
		
		print ("Is the number higher or lower than " + guess + "?" );		
		print ("Up = higher, down = lower, return = equal");
	}
	
	
	// Update is called once per frame
	void Update() {
		
		
			
	}
}
