# Binary Search/Guess The Number Game

Hello all, this is my first topic.

I made a setup for a “guess the number” game where you think of a number from 0 to 6 and the computer will try to guess it. Every time it makes a guess, it stops and you tell the computer if your number is higher or lower than the guess it made, then you start it again. Keep going until it gets your number right, and it only takes at most 3 guesses.

I think this would make a good puzzle: can you recreate my AI?

Output guess is a 3 bit register, where every time you reset the computer, you manually set the first guess to 3. The computer doesn’t have to automatically set the first guess, but it must start at 3.
Higher/lower input is a normal bit in my solution, as it only needs to be read once each time. It doesn’t matter which side is higher or lower.
The computer must be smart, limit of 3 guesses!

Let’s see what you can come up with! I will provide my solution when someone asks for it or solves it.

EDIT: Solution
EDIT 2: Specified red start button (sorry!!)

The guess output is the lowest 3 bits. The higher/lower input is the leftmost bit (not the gears), where pointing left is higher and right is lower. Red/right side always starts (Push to Start button). Here’s a link to a simulation.
jstumble

4 Likes

How many parts did it take you?

1 Like

35 parts + 2 marbles on each side. Did you want to know how many of each piece?

1 Like

X friend. Love this ai. I will be teaching TT 12 to 14. NEXT week in Italy. Love your input of would love to solve it. but have no time to try a solution now. Could you pls share the solver board to me ? . Recognition to your work and solution shall be respected. Dr.jesso

2 Likes

I have edited my post to include a link to my solution.

1 Like

Ciao tumfan. I tried your very interesting jstumble AI number guess.
Initial out of the Tumble is 3. "b011 as in your example suggests.
The Number i selected (secret) is 5 , *b101, And in view of the “3” initial, I must give a “higher” flag to the leftmost Bit piece.
i.e. My 5 is higher than his 3.
Expected TT to , based on my input , to write his next guess bit in the "triple bit " and the flow going on.
Instead first ball B gets intercepted immediately. triple bit guess left untouched,.
What an unpleasant surprise. I tried reasoning w/o success.
Help greatly appreciated. Have a good w-e. Jesso

2 Likes

Hi. is Gear initial condition to “right hand”?
Appeard that intercept comes too early.
For my selected 101, what is the color sequence of 3 balls dropped?
R X X
Thanks
jesso

2 Likes

When you click the link, the gears and everything else is in the correct/default position. The only thing you have to set yourself is the higher/lower bit. The gears start pointing to the right, but the computer will have to flip them to calculate the guesses and you don’t need to flip them back. Just click the link again if you want to start over. Every time you start the computer, you click the “red lever” button. The computer will modify the guess, then it will automatically release a blue ball. The blue ball may or may not modify the the guess again, but either way the blue ball will be intercepted. If the number is still incorrect, specify if your number is higher or lower than the guess, then click the “red lever” button and the computer will make one final guess, and it’s always right.
If you guess 3, the computer will already be right since the guess is 3 by default, so no need to start the computer, ball output is empty.
If it’s not 3, the computer will make a guess when you start it and the ball output will be just one red ball and there will be a blue ball intercepted. If the guess is still wrong then you release another red ball, it will go to the ball output making it now “RR”. The red ball will trigger the blue ball again and it will be intercepted. If you do this on a real board the interceptor will have 2 blue balls in it, but the simulator will only show 1. The number should be correct by now.
I hope this helps, and I’m sorry this is a little confusing

1 Like

Does no one want to try this? Is my puzzle not clear? Or is no one seeing this?

Here is my try: jstumble

The upper bit is the +/-: left for -, right for +

1 Like

Thanks for trying it out!! This is interesting logic: I see that when I say “higher”, it goes to 5 so that the next guess can be 4 or 6, eliminating the need for a fourth guess when I pick 6. However, it doesn’t follow the same binary search logic when picking lower numbers. Instead, it just decrements over and over again until it’s right. That means when I pick 0 it takes 4 guesses: 3, 2, 1, 0. Do you think you can perfect it to be within 3 guesses (including 3)? You’re on the right track!