I Still dont fully understand how to use maps. If someone can explain to me how to randomly select words from a map i would really appreciate it. heres what im working on.
void FBullCowGame::Reset()//TODO make more RICH return value
{
MyCurrentTry = 1;
MyMaxTries = MAX_TRIES;
//words for hidden guess
TMAP <int32, FString> HiddenWordFromMap
{
{1, "power" },
{2,"stick"},
{3,"comedy"},
{ 4,"wizard" },
{ 5,"magic" },
{ 6,"house" },
{ 7,"eight" },
{ 8,"sharp" },
{ 9,"sight" },
{ 10,"knight" },
{ 11,"solar" },
{ 12,"vertical" },
{ 13,"desktop" },
{ 14,"terminal" },
{ 15,"symbolic" },
{ 16,"storage" }
};
//Not sure how to get the random number to select a word
FString HIDDEN_WORD = HWords[WordRandomizer()];
MyHiddenWord = HIDDEN_WORD;
}
//returns random number
int32 FBullCowGame::WordRandomizer()const
{
srand((unsigned int) time(NULL));
int32 WordToChoose = (int32) rand() % 16 + 1;
return WordToChoose;
}
Also just more understanding of how to use maps would be great. ive been doing fine until i started using maps.