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 trial

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. :)