EGuessStatus FBullCowGame::CheckGuessValidity(FString *Guess) const
{
	if ((*Guess).length() != GetHiddenWordLength()) {
		return EGuessStatus::WRONG_LENGTH;
	}
	else if (!IsIsogram(Guess)) {
		return EGuessStatus::NOT_ISOGRAM;
	}
	else if (!IsLowercase(Guess)) {
		return EGuessStatus::NOT_LOWERCASE;
	}
	else {
		return EGuessStatus::OK;
	}
}
Example #2
0
EGuessStatus FBullCowGame::CheckGuessValidity(FString Guess) const
{
	if (!IsIsogram(Guess)) // if the guess isn't an isogram
	{
		return EGuessStatus::Not_Isogram;
	}
	else if (!IsLowercase(Guess)) // if the guess isn't all lowercase
	{
		return EGuessStatus::Not_Lowercase;
	}
	else if (Guess.length() != GetHiddenWordLength()) // if the guess length is wrong
	{
		return EGuessStatus::Wrong_Length;
	}
	else
	{
		return EGuessStatus::OK;
	}
}
EGuessStatus FBullCowGame::CheckGuessValidity(FString ThisGuess) const
/*
Checks the user guess for validity
- checks if an isogram
- checks if all lower-case
- checks if correct length
Returns error code if fails any of those checks
*/
{	
	if (!IsIsogram(ThisGuess)) 
	{ // if the guess is not an isogram
		return EGuessStatus::Not_Isogram;
	} 
	else if (!IsLowercase(ThisGuess)) 
	{ // if the guess is not lower-case
		return EGuessStatus::Not_Lowercase;
	} 
	else if (ThisGuess.length() != GetHiddenWordLength()) 
	{ // if the guess is different length from hidden word then return error
		return EGuessStatus::Wrong_Length;	
	};
	return EGuessStatus::OK; // TODO Later make actual error
}; // CheckGuessValidity