I don't have any friends :) Can someone playtest my game?

There is my source code, if someone could playtest it that would be awesome!

By the way it’s quite different to the course, as I implemented a lot of stuff myself before the lecturer, and then updated anything if he was using techniques that I hadn’t seen before.

So it allows non isogram words and upper or lower case letters etc.

Hey Jack, I played your game, I couldn’t figure out the word. I tested things like “hjkl” knowing the last three letters would be nonsense to try and figure out what the first letter was going to be, but the bulls and cow were inconsistent. As a player, this was frustrating, but for a first time player, I would have been completely lost and quickly given up on this game (if I even attempted it in the first place) because there were no instruction. The very first thing a programmer/game designer should communicate to a player is the objective, and then the parameters (rules) in which the player may accomplish this objective. You need a “std::cout” line (or several) to describe the objective of the game and the rules. Also, check out the consistency of the bulls and cow, and what they mean. Check out the intro to mine, it clearly states the objectives, definitions and rules.

You’re a legend thanks for playing and the advice!

I will implement your suggestions when I get home from work.

What a wonderful community!

The word is ‘pool’ by the way

Yeah, I figured that out by evaluating the code. Pool uses the letter “o” twice, so it’s not an isogram. I replaced the word with “hope” and all the errors went away.

I implemented a bunch of stuff to be able to deal with non-isogram words, that’s probs why you couldn’t get it though because you were expecting an isogram

The way I do that by the way is pretty simple, I just create a temporary word which matches the magic word (correct answer) and subtract letters from it if they are in the guess. This way every letter can be considered unique, e.g. if you pot ‘oolo’ but the word is ‘pool’, you only get 3 bulls because the letter ‘o’
only occurs twice in the answer:

FBullCowCount FBullCowGame::GetBullsCows(FString){
BC.Bulls = 0;
BC.Cows = 0;
FString MagicTemp = MagicWord;
FString GuessTemp = Guess;
//Loop through every letter in guess
for (int32 j = 0; j < Guess.length(); j++) {
//First see if letter matches, which gets a cow
if (GuessTemp[j] == MagicWord[j]) {
BC.Cows++;
}
//Then loop through the magic word letters, remove the letter on match
for (int32 i = 0; i < MagicTemp.length(); i++) {
if (GuessTemp[j] == MagicTemp[i]) {
BC.Bulls++;
MagicTemp.erase(i,i);
}
}
}
return BC;

The code works out, but I don’t think the logic does, how is the code supposed to differentiate the “o” in position [2] from the “o” in position [3] in the word “pool”. That’s why I was getting inconsistent numbers of bulls and cows. If I put two "o"s in the word, one in the right place and one in the wrong, I would get 2 bulls and 2 cows. That makes for a total of four letters; however, one of these letters was being read as a bull and a cow at the same time. I think this is why an isogram was necessary from the start.

Can you please “Build” an .exe so I can easily boot this in the command prompt?

edit; Sorry, just found out we can’t do .exe files here.

The first thing is that bulls and cows are reversed, a bull was supposed to mean the letter is in the exact position (something like bull for bullseye).
But even ignoring that the logic is flawed.

Some tests with magic word = ‘google’ :

planes - Expected: 0Cows, 2Bulls - Result: 0Cows, 1Bull
googla - Expected: 5Cows, 0Bulls - Result: 5Cows, 5Bulls
moogle - Expeced: 5Cows, 0Bulls - Result: 5Cows, 6Bulls
gggggg - Expected: 2Cows, 4Bulls - Result: 2Cows, 7Bulls
oooooo - Expected: 2Cows, 4Bulls - Result: 2Cows, 2Bulls

Maybe you may not agree with me on the expectations, but at least the results should be consistent. The first step is to define what rules should the non-isograms follow. Then you can test the game as I did, comparing what you would expect if you follow the rules with what the game says.

Thanks very much for the play test and feedback Manel, sorry it took me so long to reply I’m just getting back into this now after I went away and learnt more about C++.

Privacy & Terms