BullCowGame - Pseudo Code

My pseudo code:

#include "BullCowCartridge.h"

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

    // Setting up game
    // Set Lives
    // Set the HiddenWord
    HiddenWord = TEXT("but");
     
    //Printing welcoming message
    PrintLine(TEXT("Welcome to the BullCow Game!")); 
    PrintLine(TEXT("Guess the 3 letter word!")); //Later change hard coded number to variable
    PrintLine(TEXT("To continue press enter..."));




    // Prompt Player Guess
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    ClearScreen(); // Clear screen before any action happen

    // Checking PlayerGuess

    if (Input != "") // Check if input contains something
    {
        if(Input == HiddenWord) // User entered right answer
        {
            PrintLine(TEXT("YOU WIN!"));
        }
        else
        {
            // Check if Isogram
            // Check Right Number of characters
            // Say if answer was valid

            // If not promt user about it and let him guess again

            // If it was valid but not correct remove 1 life
            // Check if lives > 0
            // If yes GuessAgain
            // Show Lives Left
            // If no ShowFailMessage and HiddenWord

            // Promt user to play again, Press emter to play again?

            // If yes restart game
            // If no Quit game

            PrintLine(TEXT("YOU LOSE!"));
        }
    }
    
    
}
1 Like

Awesome job posting your code!

Privacy & Terms