# Jauq, My Confident Number Wizard

Here I have my very confident number wizard.
I’ve made a few additions just because I wanted to. I have past experience with Ruby, and used some of my past knowledge here. Also online documentation is quite useful.
I’m editing this page a lot because I want to figure out how to properly write code into a post

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

public class NumberWizard : MonoBehaviour {
int numMax = 1001;
int numMin = 1;
int guess = 500;
int lastGuess = 500;
int guessCount = 1;

// Use this for initialization
void Start ()
{
Debug.Log("Здравствуйте! I wish I knew more of my bloodlines language.");
Debug.Log("Living in America made me lose it. Oh well now to number wizard!");
Debug.Log("I have a preposition:");
Debug.Log("I can guess any integer you think of between 1000 and 1.");
Debug.Log("And I can do it in 10 guesses or less.");
Debug.Log("My first guess is " + guess + ". How accurate am I?");
Debug.Log("Press Up Arrow if your number is higher.");
Debug.Log("Down Arrow if your number is lower.");
Debug.Log("Return/Enter if I guessed correctly.");
guessCount += 1;
}

// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
if (guessCount < 11)
{
numMin = guess;
lastGuess = guess;
guess = (numMax + numMin) / 2;
}
if (guess == lastGuess)
{
Debug.Log("I am certain that your number is " + guess + ".");
}
else if (guessCount == 11)
{
Debug.Log("I am certain that your number is " + guess + ".");
}
else
{
Debug.Log("Too Low? Guess number " + guessCount + ": " + guess + ". How accurate am I?");
guessCount += 1;
}
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
if (guessCount < 11)
{
numMax = guess;
lastGuess = guess;
guess = (numMax + numMin) / 2;
}
if (guess == lastGuess)
{
Debug.Log("I am certain that your number is " + guess + ".");
}
else if (guessCount == 11)
{
Debug.Log("I am certain that your number is " + guess + ".");
}
else
{
Debug.Log("Too High? Guess number " + guessCount + ": " + guess + ". How accurate am I?");
guessCount += 1;
}
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Fantastic! " + guess + " is your number. As I said, I've guessed it in " + (guessCount - 1) + " tries." );
}
}
}``````