3b1b / videos

Code for the manim-generated scenes used in 3blue1brown videos
5.79k stars 1.55k forks source link

Wordle solver gives invalid 'hard mode' results #15

Open chigozienri opened 2 years ago

chigozienri commented 2 years ago

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 with patterns[:, :] += 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.

McAJBen commented 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":