Tired of waiting?
Click here to disable ads!
You are not logged in. If you sign up for an account,
you can gain additional voting power over time, allowing your vote to have an even
greater impact on submission scores!
This is my first project on learning to code in C# and use the Unity game engine, it's a simple code that tries to guess a number.
Edit: I've made some changes to the algorithm, now it should be much more precise!
Thank you, it's quite a simple trick really, it's the speed at which the computer calculates that makes the illusion.
I beat it on my third try.
There seems to be a glitch on at least one number.
Yeah, the code wasn't very efficient, but i updated it, now it should take you a little longer to beat the machine!
Nothing happened i was thinking of 200
HI, I update the code, i'm pretty sure it will be able to guess now, wanna give it another try? :D
But it fails
A real logical attempt would be to always start with 501 or 500.
Let us assume that the number will be lower for the first 8 guesses.
This assumption doesn't matter as below and above will always be split about half.
--> 1st guess: 501 --> 499 numbers above, 500 numbers below
--> 2nd guess: 251 --> 249 numbers above, 250 numbers below
--> 3rd guess: 126 --> 124 numbers above, 125 numbers below
--> 4th guess: 63 --> 62 numbers above, 62 numbers below
--> 5th guess: 32 --> 30 numbers above, 31 numbers below
--> 6th guess: 16 --> 15 numbers above, 15 number below
--> 7th guess: 8 --> 7 numbers above, 7 numbers below
--> 8th guess: 4 --> 3 numbers above, 3 numbers below
--> 9th guess 2 --> 1 number above, 1 number below
--> 10th guess automatically correct as it can only be 1 or 3.
So if you use a really logical attempt there isn't even a chance to fail with 10 attempts.
Yeah, initially that's how it worked, but then the "trick" was too obvious, what it does now is guess a random range between the maximum and minimum and adjusting them accordingly, I was talking to a friend who's more savvy in mathematics and he thinks the actual algorithm could be nearly fail proof in 15 guesses, but to be quite honest this game was more an exercise on trying to learn c# and unity than really trying to make a good game e.e''
Oh... It didn't guessed my number, I tried three times... :(
Hello, I updated it's code, i'm pretty confident it should be able to guess your numbe now, why not give it another chance? :)
Snake Re-imagined And Taken To The 3rd Dimension!
Be a badass and go on an epic kung fu quest!
Learn puppet reptile's best ABCs in this physics-driven interactive storybook
newgrounds.com — Your #1 online entertainment & artist community! All your base are belong to us.