Open chigozienri opened 2 years ago
Issue is in https://github.com/3b1b/videos/blob/d941d2d29757e5bc16c2ef21208efa40fb0cc048/_2022/wordle.py#L102-L109
Wordle website uses a different algorithm that first checks for correct letters and will ignore duplicates. For instance if the word is "ELDER" and the guess is "ERROR":
The hard mode solver gives this as a possible hard mode sequence: CRANE CACTI CAPUT CATCH
The third guess, CAPUT, is invalid in hard mode, because it doesn't take into account the fact that the second C in CACTI was marked as yellow.
I believe that the bug is in the
generate_pattern_grid
function, which checks if yellow squares contribute to the result withpatterns[:, :] += tp * equality_grid[:, :, i, :].any(2)
I can't see a way to fix it while keeping the code vectorized.I suspect this bug also distorts the non-hard mode results, but in a way that can't be detected just by looking at the results.