Homework 6 (Guessing Game) FAQ

Q: Where do I start?

A: Read the write-up in its entirety. Try to develop the program in stages. Review example programs from section and lecture.

Q: How do I compute the best game (fewest guesses)?

A: You mostly have to figure this out for yourself, but here are some hints. In each game you should keep track of how many guesses were needed. You should probably also keep track of the best game you have seen so far, and update that value accordingly after every game, if the game is better than the best one seen previously. You will have to carefully manage your returns and parameters to make sure that the right information reaches the right parts of your code, but it can be done.

Q: Is it okay to have a function that calls itself? Or to have a Function A that calls Function B, which calls A, which calls B, ...?

A: No, you should not do this on Homework 5. Having a function call itself is actually an advanced computing technique called recursion. Recursion is not an appropriate algorithmic technique for solving this problem. You can solve the problem correctly using while loops for repetition, instead of recursion.

Q: Since the program is so random, how can I possibly match the expected output? How can I use the Output Comparison Tool?

A: You don't have to match the randomly generated numbers shown in our output logs. But you should have the same format as our logs.