My BullCowGame with the added ability to randomize the hidden word!

FBullCowGame.zip (3.6 KB)

I’m new to C++ (coding in general), but I thought I’d add something I saw in Beginning C++ Through Game Programming, a fantastic book recommended earlier on in the course. When we reset the game, instead of using the same hidden word we choose from a vector of Fstrings at random. I set this up under the Reset method within FBullCowGame.cpp, and I think it makes sense to keep it there. Every time we reset the game we generate a new random number which is associated with one of the elements (Fstring) in the vector.

I noticed I had an issue with PrintIntro() though as the reset occurs within the PlayGame() function, so the letter count in the intro would not update with each reset. To fix this, I removed PrintIntro() from the main function and put it directly after the call to reset (please correct me if the wrong terminology), so that it updates the letter count in the intro after each reset. If there’s a better way to do any of the above I am certainly all ears.

Very Respectfully,
Dan

Privacy & Terms