Section 2 Lecture 39

Couldn’t wait to get some ASCII art in for the title screen. Looking forward to polishing this game up and moving in to Unreal!


Yeah, if you did that, i must bow to your ASCII superiority…

Nothing more than a couple of minutes on Paint and then running the image through a site like this haha!

1 Like

I’ll be taking that link off your hands, thank you. :slight_smile:

I went about this a different way because the code is tighter. The only part that is different is the SubmitValidGuess.

Will I run into trouble with this?

for (int32 MHWChar = 0; MHWChar < WordLength; MHWChar++) {
	// compare letters against the guess
	for (int32 GChar = 0; GChar < WordLength; GChar++) {
		// if they match then
		if (Guess[GChar] == MyHiddenWord[MHWChar]) {
			if (MHWChar == GChar) {
				// increment bulls if in the same place
			else {
				// increment cows if not
		if (Guess == MyHiddenWord) {
			bGameIsWon = true;
return BullCowCount;

I don’t think it will but hopefully someone can tell me if it will.

Hi, I didn’t wanted to change the condition in the while, so I decided to create an IF statement with a break to leave the do while loop.

void FBullCowGame::Playgame()
do {

  FBullCowCount CurCount = GetCowsandBulls(Getinputfromplayer());
  std::cout << "Cows: " << CurCount.cowcount << "\n";
  std::cout << "Bulls: " << bullsum << "\n";
  if (isgamewon(CurCount))
  	std::cout << "You've won \n";

} while ( CurrentTries <= MaxTries );


Privacy & Terms