Nimz
- 81
- 0
I wrote a program for my calculator where the goal is for the user to determine the "randomly" selected number within a certain number of guesses. For the time being, I don't care that the number generator is only pseudorandom. The selected number, x, is always 1 \leq x \leq 100, and the clues given are whether the number the user selects is closer, farther away, or the same distance from the selected number, compared to the previous guess. Basically, it's a hot and cold game.
A sample of what the inputs and outputs might look like is as follows:
? 40
- Nope
? 60
- Hot
? 80
- Cold
? 51
- Hot
? 59
- Lukewarm
? 55
- Congratulations! You won!
I have found a strategy that guarantees a win in no more than 10 guesses when on the 1-100 interval. Based on a limited number of small trials, I'm guessing that up to 2n+1, the optimum strategy will guarantee a win in no more than n+1 guesses. For the 1-100 interval, that means my guess is that no more than 8 guesses are needed for the optimum strategy. Can anyone here help me to verify that, and if possible, provide such a strategy?
A sample of what the inputs and outputs might look like is as follows:
? 40
- Nope
? 60
- Hot
? 80
- Cold
? 51
- Hot
? 59
- Lukewarm
? 55
- Congratulations! You won!
I have found a strategy that guarantees a win in no more than 10 guesses when on the 1-100 interval. Based on a limited number of small trials, I'm guessing that up to 2n+1, the optimum strategy will guarantee a win in no more than n+1 guesses. For the 1-100 interval, that means my guess is that no more than 8 guesses are needed for the optimum strategy. Can anyone here help me to verify that, and if possible, provide such a strategy?