3b1b / videos

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

Probability distribution of patterns and entropy calculation #49

Closed jameelhassan closed 1 year ago

jameelhassan commented 1 year ago

As per the source code below, to calculate the pattern distribution, it uses _possiblewords to generate the distribution. Instead, shouldn't we use _allowedwords for this, since any of the allowed words can be generating a given pattern. ie: the function call should be get_pattern_matrix(allowed_words, allowed_words) ??

def get_pattern_distributions(allowed_words, possible_words, weights):
    """
    For each possible guess in allowed_words, this finds the probability
    distribution across all of the 3^5 wordle patterns you could see, assuming
    the possible answers are in possible_words with associated probabilities
    in weights.
    It considers the pattern hash grid between the two lists of words, and uses
    that to bucket together words from possible_words which would produce
    the same pattern, adding together their corresponding probabilities.
    """
    pattern_matrix = get_pattern_matrix(allowed_words, possible_words)
jameelhassan commented 1 year ago

Got this sorted. The codebase as it is, is correct

Lets say I choose the word CRANE. In order to get all greys, it means that the ANSWER shud not have any of the letters in “crane”. So the probability of getting all greys is the number of ANSWER WORDS without any of the letters in “crane” divided by the total number of words in the answer list.