norman at littletank.org
Thu Nov 10 14:30:05 CET 2005
> I assume the way the computer is going to guess is by trying some
> number, and you respond either that it's guessed right, or to go lower,
> or to go higher.
Yes, that is correct.
> In that case, think of "bisection". Originally, all the computer knows
> is that the number is in some range, say 0 to 100. It can then guess
> the midpoint, 50. If it's right, yay! Otherwise: if it's told to go
> lower, then the range is now 0 to 49 -- if higher, it's 51 to 100; in
> each case the range was just halved (actually, a bit more than halved).
Thank you, I thought that might be the case. So, I will have to settle
down and try to write some pseudo-code first. I hope to be back.
More information about the Python-list