My difficulty tuning choices and code

Hello all,

Taking on Ben’s challenge for an extra difficulty level, I choosed to try and do it, I believe i have archived what was intended.

I created another method in the main.cpp file, called GetGameDificulty, that returns an int32 that is the length of the word chosen by the user.

int32 GetGameDificulty(FBullCowGame &BCGame)
{
	int32 length = 0;
	constexpr int32 MAX_LENGTH = 8;
	do
	{
		std::cout << "Please choose the size of the hidden word(from 1 to 7): ";
		std::cin >> length;
		if (length < 1 || length > MAX_LENGTH)
			std::cout << "Please choose a size between 1 and 7 \n";
	} while (length < 1 || length >MAX_LENGTH);
	return length;
}

I “call” this method in PlayGame(), before calling BCGame.reset(), and I changed reset() to need an int value so it can access the TMap position that is returned by the SetHiddenWord() method.

You can see all the code in this github -> https://github.com/CromixPT/Section_02/tree/master/BullCowGame

Hoping for some feedback to where it can be improved.

Thank you,
TCandeias

I went ahead and used a portion of your code in mine. If you go to the post I have Here. You can see how I went about working around some things “wrong” with yours.

Privacy & Terms