Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSeab Jackson
5,692 PointsImproving random guessing game
I am thinking that we cannot improve the guesses in this game even if we were to indicate that our guesses was higher or lower than the random number. It makes more sense to me if I had a fixed number and I tried to guess it with useful prompts for if I'm higher or lower than the fixed value, but how is that even useful for guessing a random number?
2 Answers
Dan Johnson
40,533 PointsIf you only get one guess, then you're right, it's not really useful. However if you were to further extend the program to allow for multiple guesses on the same number the prompts become useful as you can apply a binary search with the new information.
If you're familiar with loops you could accomplish repeated guesses with them.
Laura Drew
5,828 PointsI'm not entirely sure I understand your question correctly but once the random number is generated, it has a fixed value.