Question about CheckGuessValidity logic

So we start out here looking at guesses of length 0 and 1 in the IsIsogram method. Then letting them pass through as an isogram. They are not, so why allow it? Wouldn’t it be better in the CheckGuessValidity method, to first check the length of guess? If the guess is 0 or 1 character the method would immediately return the incorrect length status and no guess would get to the IsIsogram method with those lengths.

Also, we are checking for the case of the letters of guess. Why? It has already been hinted that we are going to change any uppercase letter to lower. In one guess a non alphabetic character / is used. Shouldn’t that be the second check we make? Special characters/symbols or numbers would invalidate an isogram, correct? Wiki has some nice hypothetical words that use hyphens but those are hypothetical not the definition (as they use multiple hyphens). Is the “space” character allowed? The last check would/should be the IsIsogram method checking for duplicate letters.

I am watching these in order, so if these issues have been addressed later I apologize.

Not entirely sure, because Ben wanted to I guess is the answer.

Yes.

Pretty sure this doesn’t happen, but what you’re suggesting is what I did.

“If islower returns true, it is guaranteed that iscntrl, isdigit, ispunct, and isspace return false for the same character in the same C locale.” So that should already be taken care of.[quote=“sabelhj, post:1, topic:17247”]
The last check would/should be the IsIsogram method checking for duplicate letters.
[/quote]

I agree, feel free to do that.

Privacy & Terms