FBullCowGame.zip (3.6 KB)
In the reset method of our FBullCowGame class i have made an array of strings to store prewords and eachtime the game resets i will give the player a new words to guess, all done by bellow code:
just replace the const Fstring HIDDEN_WORDS = “plane” (inside reset method of our BCGame class) to the codes i wrote bellow.
const int32 MaxWordNumber = 8; // length of our RANDOM_WORDS array, we change this if we want mote items in RANDOM_WORDS array (magic number)
const Fstring Random_Words[MaxWordNumber] = { "crazy", "machine", "music", "plane", "lucky", "right", "lover", "game" }; // words MUST be isogram
srand(time(NULL)); // set the seed of random to current seconds since January 1, 2000 in the current timezone, otherwise the rand() will allways return same resaults everytime you open the game
const Fstring HIDDEN_WORD = Random_Words[rand() % MaxWordNumber - 1]; // get a random word from the list