![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^3: Number Guessing Gameby roboticus (Chancellor) |
on Sep 23, 2012 at 17:47 UTC ( #995224=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|