Order of checks in Bulls & Cows

   if (Guess.Len() != HiddenWord.Len())
    {
        PrintLine(TEXT("The hidden word is %i letters long"), HiddenWord.Len());
        PrintLine(TEXT("Wrong number of characters,\ntry guessing again.\nYou have %i lives remaining."), Lives);
        return;
    }

    // Check Is Isogram
    //if (!IsIsogram)
    //{
    //    PrintLine(TEXT("No repeating letters! Guess again."));
    //    return;
    //}

    if (Guess == HiddenWord)
    {
        ClearScreen();
        PrintLine(TEXT("You have Won!"));
        EndGame();
        return;
    }

In my opinion the ordred of checks should be:

  1. Check if guess has right number of characters. We doing this first because there can be an isogram with inappropriate number of characters.
  2. Check if isogram.
  3. Check if guess is correct after we know it is an proper length isogram.

Privacy & Terms