in reply to Re^2: Number Guessing Game
in thread Number Guessing Game
The problem is that you're selecting a number at random throughout the range, and you're never adjusting the range. For example, if we were playing the game using 1-100 as the range and you guessed 65 and I said "low", then you'd want to guess a number between 66 and 100. If you then guessed 75 and I said "high", you'd want to guess a number between 66 and 74.
So you need to update the upper or lower limit based on the feedback from the user.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Number Guessing Game
by randomhero1270 (Novice) on Sep 23, 2012 at 18:17 UTC | |
|
Re^4: Number Guessing Game
by randomhero1270 (Novice) on Sep 23, 2012 at 17:57 UTC | |
by roboticus (Chancellor) on Sep 23, 2012 at 19:24 UTC |