Number Wizard - do you have problem with rising max number?

Hello Everyone!
I am new in coding, so may be this is the reason of my ignorance but I didn’t get why I am having problem with Numbers in Numba Wiz’d
My min and Max are Serialized. I made them 1 and 1000.
where is the code:

So… my Bug is:
You are not suppose to do so but still… if you and pressing “my number is upper” while playing all the way up to 1000 and CONTINUE to do so… the max number will grow… like 1001, 1002… etc…
may be I need some sort of restrictions in my coding?
and WHY it doesn’t happen clockwise, all the way down? it’s always 1. Int can be less then 1…then what?

Hi Andrei,

Actually, we do not support the project from the archived courses anymore. I am vaguely remembering this project.

may be I need some sort of restrictions in my coding?

Yes, that sounds like a good idea. :slight_smile:

If I remember correctly, the problem was caused by the incrementation of min and max in the OnPressHigher and OnPressLower methods.

The best would be to log the values into your console with Debug.Log to see what’s going on at runtime. Once you figured that out, implementing a restriction (if necessary) is relatively simple. If you need a restriction but do not know if-statements yet, look for C# if-statements online, for example, on DotNetPerls.

Also please feel free to ask our helpful community of students over on our Discord chat server.

Good luck! :slight_smile:


See also:

Oh, Thanks Nina!
Great!
Sorry, I want’s sure is you support those courses or not.

Thank you for the answer.
I was curious why does it happen to max and not to min…
but I see what can be done here.

Unfortunately, I don’t remember this project that well anymore. The last time I took a look at it was about 3 years ago.

I think the problem was how we “process” the guess value. The max value of the Random.Range method is exclusive. If you log min, max and guess into your console, you will see if the values make sense.

In your game, you have three cases:

  • min < max
  • min == max
  • min > max

Play your game and try to figure out what happens in these cases. At the moment, you do not prevent the player from cheating. Maybe the problem occurs when you start cheating?

For simplicity, set max to, for example, 3 and min to 1 in your Inspector.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms