Welp... I went for a different aproach

I made it a boolean instead :flushed: lol

void UBullCowCartridge::BeginPlay() // When the game starts
{
    Super::BeginPlay();
    const FString WordListPath = FPaths::ProjectContentDir() / TEXT("WordList/HiddenWordList.txt");
    FFileHelper::LoadFileToStringArray(Words, *WordListPath);

    SetupGame(); // Setting up game

    TArray<FString> ValidWords;
    for (int32 i = 0; i < Words.Num(); i++) // Get each index on the array
    {
        if (GetValidWords(Words[i]))
        {
            ValidWords.Emplace(Words[i]);
        }
    }
    PrintLine(TEXT("%i"), ValidWords.Num());
}

bool UBullCowCartridge::GetValidWords(FString Word)
{
    if (Word.Len() >= 4 && Word.Len() <= 8)
    {
        if (IsIsogram(Word))
        {
            return true;
        }
        return false;
    }
    return true;
}
2 Likes

How did it work?

It worked the same as having it being a TArray but opted to do it the in course’s intended way since later i got a bit confused with all the const and reference stuff. It looked to me that trying to get the random words from the list was gonna require more work doing it the boolean way

Privacy & Terms