Here is a Number Wizard from Brazil

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

public class NumberWizard : MonoBehaviour
{
int maxPick = 1000;
int minPick = 1;
int guess = 500;
// Start is called before the first frame update
void Start()
{

    Debug.Log("Seja bem vindo ao Number Wizard!!! YAYYYYY");
    Debug.Log("Pick any number! But don't tell me! I'm going to guess it!!!\n Now go ahead and pick any number");
    Debug.Log(maxPick + " being the highest,");
    Debug.Log(minPick + " being the lowest!");
    Debug.Log("Now I'm going to give you my best guess. You chosen the number: "+ guess);
    Debug.Log("If you chose a Higher number press the UP arrow; If it is Lower press the DOWN arrow; \nIf it is Correct press ENTER");
    maxPick++;

}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        Debug.Log("Oh, no! The number picked is higher than the guess!");
        minPick = guess;
        guess = (minPick + maxPick) / 2;
        Debug.Log("But wait, I have a new guess! Is it: " + guess);
    }
    
    if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        Debug.Log("Oh, no! The number picked is lower than the guess!");
        maxPick = guess;
        guess = (minPick + maxPick) / 2;
        Debug.Log("Wait a little...I guess i got it wrong because it was:" + guess);

    }
    if (Input.GetKeyDown(KeyCode.Return)) 
    {
        Debug.Log("Oh yeah! The Number Wizard always gets it right! lol");
    }
    else
    {
        
    }
}

}

1 Like

Phenomenal job! :tada:

1 Like

Thanks :grinning_face_with_smiling_eyes:

Privacy & Terms