Wordle duplicate-letter feedback algorithm
This Wordle game flowchart focuses on the scoring rule that often causes implementation mistakes: duplicate letters. After validating that a five-letter guess is allowed, the algorithm counts letters in the target word. It makes a first pass to mark exact-position matches green and reduces the available count for each matched letter.
Open it in the AI editor with a prompt pre-filled — keep what works, change what doesn't.
Scenario
A Wordle-style game must score a valid guess correctly when the guess contains more copies of a letter than the target. The two-pass order prevents extra duplicate letters from receiving misleading yellow tiles.
Key decisions
- Input validation: The guess must have five letters and appear in the allowed list.
- Target counts: A per-letter count records how many target letters remain available.
- Green first: Exact-position matches are assigned before any yellow matches.
- Limited yellows: A non-green letter becomes yellow only while its remaining target count is positive.
When to reuse this
Use this when implementing or teaching Wordle feedback logic, especially the duplicate-letter edge case. It describes one scored guess rather than the full six-attempt game loop.
Frequently asked questions
Why mark green tiles before yellow tiles?
Why keep letter counts?
Does this include the six-guess game loop?
Tweak it with chat, export PNG/SVG, or fork it for your own use case.