I play the number guessing game with positive integers and a known constant upper bound. Every time I make a guess about the number I have to pay 1 dollar but if my partner answers 'Yes' I have to pay 9 more.
What is the best strategy to minimize my average cost of the game (other than not playing)?
Does the strategy change if I have to pay more/less for the good guesses?
So after all, we put together a little sample script for simulation:
https://gitorious.org/campzer0/numberguessing/
We implemented the naive linear approach and two modified version of binary search:
After 10000 runs with an upper bound of 100 the results look like this:
CJ is usually ~10% better than synalgo and they both present good results compared to the naive approach.
These algorithms are of course not proven (close-to) optimal, but provide acceptable efficiency for my actual problem. Any further optimization proposals are welcome though!