Unreal build tool missing

I am in bull cows section and for some reason I can’t compile my project I am on UE 4.27

Will you please upload a screenshot of your error and also upload your code. It will help to understand the error?

1 Like


cpp

// Fill out your copyright notice in the Description page of Project Settings.
#include "BullCowCartridge.h"
#include "HiddenWordList.h"

void UBullCowCartridge::BeginPlay() // When the game starts
{
	Super::BeginPlay();
    GetValidWords(Words);
    SetupGame();

    PrintLine(TEXT("This is the amount of right words possible: %i"), GetValidWords(Words).Num());
    PrintLine(TEXT("This is the amount of words possible: %i"), Words.Num());

}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    if (bGameOver == true)
	{
		ClearScreen();
		SetupGame();
	}

	else
	{
		ProcessGuess(Input);
	}
}

// Check if isogram
// Check right number of characters
// Remove life
// If all lives lost, prompt for guess again
	// Show lives left
// Else print game over and HiddenWord
	// Prompt to play again, Press enter to play again?
	// If  yes, set hidden word and lives
	// Else quit game

void UBullCowCartridge::SetupGame()
{
    for (int32 Index = 0; Index <= GetValidWords(Words).Num(); Index++)
    {
        HiddenWord = GetValidWords(Words)[Index];
    }
	Lives = HiddenWord.Len();
	bGameOver = false;
	PrintLine(TEXT("Welcome To Bull Cow Game")); //Prints Welcome Message
	PrintLine(TEXT("The HiddenWord Is %i Charecters Long"), HiddenWord.Len()); //remove the hardcoded 4 later
	PrintLine(TEXT("Type in your guess and \npress enter to continue..."));
	PrintLine(TEXT("You Have %i Lives"), Lives);

    

    //const TCHAR HW[] = TEXT("plums");
    //PrintLine(TEXT(%c), HW[0]); p should be printed out
    //PrintLine(TEXT(%c), HW[3]); m should be the one appearing.

    
}

void UBullCowCartridge::EndGame()
{
	bGameOver = true;
    PrintLine(TEXT("Press Enter To Play Again"));
}


bool UBullCowCartridge::isIsogram(FString word)
{
    for (int i = 0, comparing_letter = i+1; comparing_letter < word.Len() - 1; comparing_letter++)
    {
        if (word.IsValidIndex(comparing_letter))
        {
            if (word[i] == word[comparing_letter])
            {
                return false;
            }
        }
    }

    return true;
}

void UBullCowCartridge::ProcessGuess(FString Guess)
{

    // Check if the PlayerGuess is the HiddenWord

    if (Guess == HiddenWord)
    {
        // The Player wins the game

        ClearScreen();

        PrintLine(TEXT("You guessed the word!"));

        PrintLine(TEXT("The hidden word is: %s."), *HiddenWord);

        PrintLine(TEXT("YOU WIN!"));

        EndGame();

        return;

    }

    if (Guess != HiddenWord)
    {

        // Clear terminal

        ClearScreen();

        // Print messages for the player telling about the mistake in the guess

        PrintLine(TEXT("Ooh sorry your guess is not correct! Hint:The hidden word has %i letters."), HiddenWord.Len());

        // Remove a life since the player missed in the guess

        PrintLine(TEXT("You lost a life. Now you have %i lives."), --Lives);

        if (Guess.Len() != HiddenWord.Len())
        {

            PrintLine(TEXT("Please remember that\nthe hidden word has %i letters."), HiddenWord.Len());

        }

        if (!isIsogram(Guess))
        {
            PrintLine(TEXT("This word has repeating letters!"));
        }

        if (Lives == 0)
        {
            PrintLine(TEXT("The Hiddenword was %s"), *HiddenWord);
            PrintLine(TEXT("Press Enter To Play Again"));
            EndGame();


        }
        

    }

}

TArray<FString> UBullCowCartridge::GetValidWords(TArray<FString> WordList)
{
    TArray<FString> Valid_Words;
    for (int32 Index = 0; Index < Words.Num(); Index++)
    {
        if (WordList[Index].Len() >= 4 && WordList[Index].Len() <= 8)
        {
            if (isIsogram(WordList[Index]))
            {
                Valid_Words.Emplace(WordList[Index]);
            }
        }
    } 
}

header

#pragma once

#include "CoreMinimal.h"
#include "Console/Cartridge.h"
#include "BullCowCartridge.generated.h"

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class BULLCOWGAME_API UBullCowCartridge : public UCartridge
{
	GENERATED_BODY()

	public:
	virtual void BeginPlay() override;
	virtual void OnInput(const FString& Input) override;
	void SetupGame();
	void EndGame();
	void ProcessGuess(FString Guess);
	bool isIsogram(FString Word);
	TArray<FString> GetValidWords(TArray<FString> WordList);

	// Your declarations go below!
	private:
	
	FString HiddenWord;
	int32 Lives;
	bool bGameOver;
	
};

the hiddenword list is the same as show in the course and since it is 1000 words long I will not post it.

1 Like

no worries I solved the error

1 Like

ok

well, what was the error?

You were not returning any TArray in the GetValidWords, Is it?

Yes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms