Number Wizard JIGSAW game

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()
{
    // These Debug's are statements
    Debug.Log("Hey ... wanna play a game?");
    Debug.Log("Pick a number ...");
    Debug.Log("Highest number is: " + max);
    Debug.Log("Lowest number is: " + min);
    Debug.Log("If I get your number, you will be slaughtered");
    Debug.Log("UP key = Higher, DOWN key = Lower, ENTER key = correct ...");
    Debug.Log("Let's begin ... is your number: " + guess);
    max = max + 1;
}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        min = guess;
        guess = (max + min) / 2;
        Debug.Log("Higher or lower than, " + guess);
    }

    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        max = guess;
        guess = (max + min) / 2;
        Debug.Log("Higher or lower than, " + guess);
    }

    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("... I win ...");
    }
}

}

Privacy & Terms