Cows & Bulls Game

This topic will be a place for me to post progress updates of the Cows & Bulls game.

This project has been completed, including some of my own personal modifications to the game!

Custom Features:

  1. Level System w/ Increasing Difficulty
  2. Anagram Save Before Loss

Check out the game here:

1 Like

Lecture 41 - Landscape Design

Here is my Basic Loop for the Bull Cow Game.

Flow Chart was made using Zen FlowChart

Here is the complete Game Loop for Bull Cow Game.

Much like the TripleX project, I would like to incorporate a difficulty level. The higher the level the longer the words can be.

Back at it today.

To start, I wrote some Pseudo Code based on the flow chart I created.

Busy Life, keep getting pulled away.

I finished the Bull Cow game today, though I am still thinking of ways I can improve it further. In the meantime, let me review what changes I made to the game.

I followed along the course, but made some slight modifications to give a sense of progression while playing the game.

Firstly I did the more “Advanced” features by having a single text file with thousands of words get file loaded to member TArray variables. I created a separate TArray variable for each level, which using the FFileHelper::LoadFileToStringArrayWithPredicate() I loaded different lengths of Isogram words into the different TArray member variables. This gave me a large variety of words for each difficulty level.

I also created a int32 Level member variable that contains the current Level, as well as a int32 MaxLevel member variable that sets how many levels there are in the game. The Level member variable increments by 1 every time a word is properly guessed, but gets set to 1 at the beginning of every New Game.

When setting up the level, the Level variable is switched on and a word from the corresponding levels list is randomly chosen.

The effect is a game that progressively gets more challenging.

So far a criticism I have of the game is that It is to challenging, even when given more lives. I am pondering some ideas for how to give more hints to the player.

An idea that I came up with to give a boon to the player right before they fail, is that on the players last life they are given an Anagram of the hidden word. Using previously received Bulls and Cows, as well as the Anagram, the player should be able to figure out the correct order of the characters. However should they fail even once at this point its game over.

This gives a boost of help right when you might need it most, but it still makes the player think critically and there is a sense of pressure because if you do not get it right at this point you will lose.

You can view my code here, and copy it into your game if you want. Remember to setup both the header file and the cpp file with the right code.

Header Code

FString CreateAnagram(const FString& Word) const;

C++ Code

FString UBullCowCartridge::CreateAnagram(const FString& Word) const
    FString ScrambledWord = "";
    FString CharArray = Word;

    for (int32 i = 0; i < Word.Len(); i++)
        int32 Index = FMath::RandRange(0, CharArray.Len() - 1);
    return ScrambledWord;

The code returns the scrambled (anagram) word when called, therefore being able to be used however you want to.

Privacy & Terms