Number Wizard Romania

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NumberWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess;

// Start is called before the first frame update
void Start()
{

    guess = (max + min) / 2;

    Debug.Log("Heei! Bun venit la magicianul numerelor!");
    Debug.Log("Pick a number, don't tell me what it is...");
    Debug.Log("The highest number you can choose is: "+ max);
    Debug.Log("The lowest number you can choose is: "+ min);
    Debug.Log("Tell me if your number is higher or lower than 500");
    Debug.Log("Push Up = higher, Push Down = Lower, Push Enter = Correct");
    max = max + 1;
}

// Update is called once per frame
void Update()
{

    guess = (max + min) / 2;
    

    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        min = guess;
        guess = (max + min) / 2;
        Debug.Log("your guess is higher...");
        Debug.Log("hmm...your number is: " + guess);
    }


    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        max = guess;
        guess = (max + min) / 2;

        Debug.Log("your guess is lower...");
        Debug.Log("hmmm...your number is" + guess);
    }
    else if  (Input.GetKeyDown(KeyCode.Return))
    {

        Debug.Log("Stiaam ca asta e!!");
    }
}

}

2 Likes

Amazing code! :smiley:

1 Like

thank you! :blush:

Pai daca tot mergi pe romana, pune si restu,:smiley:

1 Like

Heei!
Ma gandeam sa fie pe intelesul tutror si doar inceputul si sfarsitul sa fie in limba mea. :innocent:

:smiley: da bun succes, ai pus Romania si am zis sa salut.

1 Like

Bunaa :wave: :wave:
Ma bucur ca ai venit sa saluti! Succes in proiectele tale! :smiling_face_with_three_hearts:

Privacy & Terms