Here is a question that looks trivial and is not: if the expected answer is "Czechoslovakia", what should the game accept?
- Czechoslovakia - the canonical form.
- Czecho-Slovakia - a very common spelling, and not a wrong one.
- Czech and Slovak Federative Republic - the formal name.
- Československo - the local name.
- Czechoslovak Socialist Republic - the communist-era name.
A naive implementation compares the normalised string to the expected string and marks the second one wrong. The player is not wrong. They are correct, and the game is wrong about it.
The fix is a table, not a clever comparison
The robust approach is to treat every answer as having a canonical value plus a set of accepted aliases, and to normalise before you look anything up. Normalisation is boring and it is most of the win: trim whitespace, lowercase, collapse internal runs of whitespace, and decide once whether punctuation and accents matter.
After that, the lookup is a dictionary lookup instead of a guess. The interesting engineering is not the lookup, it is deciding what belongs in the table, and it has to be data rather than code. Every new historical name, spelling variant or local-language form is a data change, not a release.
The same shape shows up everywhere answers are free text: country names in a geography quiz, song titles with a leading "the", a chemical symbol written as a full word, a band name with an ampersand. The rule is always the same, and it is always the same rule: decide what "the same answer" means before you write the comparison.
There is one more thing worth copying from games that do this well: let the player tell you when the right answer was rejected. An alias report turns a support email into a one-line data fix, and the table gets better every week. The daily puzzle format is a good place to watch this happen, because the same question shape comes back every day and the accepted variants accumulate. If you want to see the format in action, daily orbs runs one such set a day.
Top comments (0)