Coding Basic Loop: Potential Issues

I am working on the basic game loop logic and I can foresee a few problems that could arise:

  1. if the HiddenWord code is placed within the Guess, Input or any other Functions afterward, the code will be reset. This will be hard to change the word or recall its length to the terminal.
  2. If placed outside the smaller Guess-Input-Answer-Outcome loop it can inject its information at any point it is called without having to be effected by the smaller loop. If the smaller is snuggled under the larger one (Hidden Word Code all the way to Correct Answer), it will only change when the conditions for winning have been met (or lives lost).

Now having done the next lesson I can see that I was both right and wrong:

  1. Right: In that the HiddenWord had to be elevated outside the game loop in some way.
  2. Wrong: Where it needed to be elevated

Where? Right outside of the .cpp file and into the header file (.h). A nice simple solution.

2 Likes

Privacy & Terms