Can't find the issue

After typing in the correct hidden word, I get my “WELL DONE - YOU WIN” prompt. But after the Intro for the new game is printed the game automatically prompts the “you win” message again without even allowing you to attempt to guess the hidden word. It’s getting the win condition after printing the intro. Not sure why. I removed a few unnecessary lines of code already, but still can’t get past this issue. Below are screenshots of my main.cpp since not sure where the issue is.

Hi @dburk1, I haven’t finished this Section yet, but the only thing that I can think is, after you ask if the player want to play again you reset the value of BCGame.IsGameWon() variable to false again? Try to debug that part and check if still returns true. If does, that while loop on void PlayGame() will skip and go to executing the PrintGameSummary() at the end. It’ll be nice to put a break point over there to check this possibility.
Once again, I haven’t finished, I’m only speculating here.
Hope you can find the issue and post here the solution.

See ya!

I had this same issue. I am new to this so I am not sure if this is the correct way to fix it, but i added a bGameIsWon = false; into the void FBullCowGame::Reset() part in fBullCowGame.cpp. this fixed the issue for me because every time the game ends now it also resets the win back to false.

1 Like

You never called Reset() in PlayGame(). Same happened to me, lost an hour of life :smiley:

This is simple and works perfectly fine.

Privacy & Terms