Pseudocode is an informal, language-independent representation of an algorithm’s logic. It uses readable sentences and words instead of executable instructions, allowing you to reason about a solution before implementing it. It has no official grammar: choose notation that makes your own logic as clear as code. section 5.2.2
Use pseudocode to turn a tricky problem into explicit, testable steps:
- Step away from the screen and describe the desired behavior before choosing implementation details. section 5.2.2
- State the rules and edge cases, such as correctly placed letters, misplaced letters, and repeated characters. section 5.2.2
- Write ordered passes, conditions, loops, and temporary state using readable notation and placeholder operations when needed. section 5.2.2
- Try concrete inputs against the pseudocode, then identify what each placeholder must do in the target language. section 5.2.2
- Convert the checked logic into code and test it with nominal, duplicate-character, and wrong-answer cases. section 5.2.2
Repeated-letter feedback
For a word game comparing SMALL with HELLO, pseudocode first marks every guess character absent, marks exact matches, then scans unmatched characters for valid misplaced matches. A fictional operation such as mark can express intent before it is replaced by Go code. section 5.2.2
Listing 5.27 Pseudo-code of computeFeedback()
func computeFeedback(guess, solution) feedback {
for all characters of the guess { #1
mark character absent
}
for each character of the attempt { #2
if the character in solution and guess the same {
mark character as seen in the solution
mark character with correct position status
}
}
for each character of the guess { #3
if current character already has a hint {
skip to the next character
}
if character is in the solution and not yet seen {
mark character as seen in the solution
mark character with correct position status
}
}
return the hints
}
Inspect the complete computeFeedback() pseudocode, including initialization, exact-position matching, unmatched-character handling, and returning hints. section 5.2.2





