pattern_a = r"[a..z][a..z][a..z][a..z][a..z]"# Unsure if this is correct.
pattern_b = r"(?=a{0,5}(?=b{0,5}(?=c{0,5}...(?=y{0,5}(?=z{0,5}"e.g:
guess = "pants" (entered by user)
score = "00012" (entered by user)
- 0 = incorrect letter
- 1 = correct letter, wrong position
- 2 = correct letter, correct position
This won't work, need more thought...
For each position:
- If
letter_score = "2":- Update
pattern_ato match exactly this letter for the position.
- Update
Then...
For each unique letter than appeared in the guess, count the number of nonzero guesses.
- If
count_of_nonzero_letter_scores = "0":- Update
pattern_bto drop the maximum score for that letter to"0".
- Update
- If
letter_score = "1":
Rather than modifying the regex each guess, an object could be modified, then a new regex generated from this object each iteration.