Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops What are Loops?

Stephen Williams
Stephen Williams
2,053 Points

Starting to think like an engineer.

This was fun. seeing how fast the the computer calculated so many guesses so fast. One run through I noticed though something odd. The computer in a 10,000 range guess used 18,000 times to guess. Meaning it almost guessed every other number in the 10,000 range twice before it solved the puzzle.
This was amusing. 18,000 guesses for a 10,000 number range is wildly inefficient. So I had to throw in some ideas on how to fix that (I know McFarland is aware of this.. I just wanted to pretend) If the program was designed that instead of guessing a random number it started at 0 and guess += 1 and increments by one every time, this would get rid of the possibility of the same number being guessed twice or more.
Seeing that bug, and fixing it was a real treat. thank you for letting me share.

It's always fun figuring things out on your own, eh? Feels like real learning instead of just regurgitating things. :)