|
Here’s the algorithm of the game’s letter marking system, based on my experience reproducing its logic for a script I wrote that computes remaining words from your guesses and their corresponding marks. Suppose the target word is “polar” and you guess “banal”. A submitted word is marked in 3 passes. 0. Initial state: (“banal”, “polar”) 1. Zip together the letters of the guess and target words, and loop through the zipped list. When both letters at a position are the same, replace the guess letter with the symbol for “correct” (green) and remove the target letter from the target word. State: (“banGl”, “polr”) 2. Loop through the target word’s letters, replacing the first occurrence (if any) of each one in the guess word with the symbol for “present” (yellow). State: (“banGY”, “polr”) 3. Replace any remaining letters in the guess word with the symbol for “not present” (black). State: (“BBBGY”, “polr”) Return the marked guess word. --- Other examples: 0. (“mamma”, “amaze”) 1. (“mamma”, “amaze”) 2. (“YYmmY”, “amaze”) 3. (“YYBBY”, “amaze”) --- 0. (“nieto”, “otoño”) 1. (“nietG”, “otoñ”) 2. (“nieYG”, “otoñ”) 3. (“BBBYG”, “otoñ”) edit: fixing formatting issues. Sorry, first time posting a comment on here. |