Skip to main content
Posted on main
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21

Clutch Wordle Solver with known inputsClutch Wordle Solver with known inputs

Sometimes when you're playing Wordle, you get to your fifth guess and you can't figure out the word any more, so you start mentally running through the list of remaining iterations, both sensical and nonsensical trying to figure out what those last few letters are.

The task here is to create all permutations of a final Wordle guess to save me from having to do it in my head, with the following rules:

General rules:

  • Wordle rules apply. All guesses are exactly 5 letters
  • Since Wordle only uses valid English words, only letters that appear on a standard English keyboard (a-z) need to be tested. However, you should include all valid permutations, not just valid English words, in your output
  • Solution is case insensitive.

Input:

  • A list of letters and indices (0 or 1 indexed, your choice), indicating the location of confirmed/green letters;
  • A list of letters and indices (consistently indexed), indicated yellow letters (i.e. the letter is known to not be at that index);
  • A list/string of letters that are yet to be guessed.

Note, green and yellow letters may still appear in more than the known positions. For example, if the input for green is [('E', 1)], there may still be an E in an index other than 1 as well.

Output:

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes (but must appear at least once in the output), and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

To confirm the list, in each case you can multiply the possible letters for each slot by the number of possible letters in all of the other slots (slot 1 * slot 2 * slot 3 * slot 4 * slot 5). (removed because I realized this is not the case if there are yellow letters)

What's the shortest way to solve this problem? You may take input and output in any convenient method or format, and the shortest code in bytes wins.


Example:

  1. Green Guesses (1 indexed): O=2, E=4, N=5
  2. Yellow Guesses: N!=3 (E!=5 is excluded because we know N=5)
  3. Unguessed Letters: Q, W, I, P, F, J, K, X, B

Output would be a list of all possible permutations given the known information, such as:

BEFIJKNOPQWX
BOBENEOBENFOBENIOBENJOBENKOBENNOBENOOBENPOBENQOBENWOBENXOBEN
BOEENEOEENFOEENIOEENJOEENKOEENNOEENOOEENPOEENQOEENWOEENXOEEN
BOFENEOFENFOFENIOFENJOFENKOFENNOFENOOFENPOFENQOFENWOFENXOFEN
BOIENEOIENFOIENIOIENJOIENKOIENNOIENOOIENPOIENQOIENWOIENXOIEN
BOJENEOJENFOJENIOJENJOJENKOJENNOJENOOJENPOJENQOJENWOJENXOJEN
BOKENEOKENFOKENIOKENJOKENKOKENNOKENOOKENPOKENQOKENWOKENXOKEN
BOOENEOOENFOOENIOOENJOOENKOOENNOOENOOOENPOOENQOOENWOOENXOOEN
BOPENEOPENFOPENIOPENJOPENKOPENNOPENOOPENPOPENQOPENWOPENXOPEN
BOQENEOQENFOQENIOQENJOQENKOQENNOQENOOQENPOQENQOQENWOQENXOQEN
BOWENEOWENFOWENIOWENJOWENKOWENNOWENOOWENPOWENQOWENWOWENXOWEN
BOXENEOXENFOXENIOXENJOXENKOXENNOXENOOXENPOXENQOXENWOXENXOXEN

In this case, there are 12, 1, 11, 1, 1 potential outcomes for each slot, so the list should have 12*11 items or 132.

In code terms, the inputs may be given as:

  • [['O', 2], ['E', 4], ['N', 5]]
  • [['N', 3]]
  • "QWIPFJKXB"

and the output as:

['BOBEN', 'EOBEN', 'FOBEN', 'IOBEN', 'JOBEN', 'KOBEN', 'NOBEN', 'OOBEN', 'POBEN', 'QOBEN', 'WOBEN', 'XOBEN', 'BOEEN', 'EOEEN', 'FOEEN', 'IOEEN', 'JOEEN', 'KOEEN', 'NOEEN', 'OOEEN', 'POEEN', 'QOEEN', 'WOEEN', 'XOEEN', 'BOFEN', 'EOFEN', 'FOFEN', 'IOFEN', 'JOFEN', 'KOFEN', 'NOFEN', 'OOFEN', 'POFEN', 'QOFEN', 'WOFEN', 'XOFEN', 'BOIEN', 'EOIEN', 'FOIEN', 'IOIEN', 'JOIEN', 'KOIEN', 'NOIEN', 'OOIEN', 'POIEN', 'QOIEN', 'WOIEN', 'XOIEN', 'BOJEN', 'EOJEN', 'FOJEN', 'IOJEN', 'JOJEN', 'KOJEN', 'NOJEN', 'OOJEN', 'POJEN', 'QOJEN', 'WOJEN', 'XOJEN', 'BOKEN', 'EOKEN', 'FOKEN', 'IOKEN', 'JOKEN', 'KOKEN', 'NOKEN', 'OOKEN', 'POKEN', 'QOKEN', 'WOKEN', 'XOKEN', 'BOOEN', 'EOOEN', 'FOOEN', 'IOOEN', 'JOOEN', 'KOOEN', 'NOOEN', 'OOOEN', 'POOEN', 'QOOEN', 'WOOEN', 'XOOEN', 'BOPEN', 'EOPEN', 'FOPEN', 'IOPEN', 'JOPEN', 'KOPEN', 'NOPEN', 'OOPEN', 'POPEN', 'QOPEN', 'WOPEN', 'XOPEN', 'BOQEN', 'EOQEN', 'FOQEN', 'IOQEN', 'JOQEN', 'KOQEN', 'NOQEN', 'OOQEN', 'POQEN', 'QOQEN', 'WOQEN', 'XOQEN', 'BOWEN', 'EOWEN', 'FOWEN', 'IOWEN', 'JOWEN', 'KOWEN', 'NOWEN', 'OOWEN', 'POWEN', 'QOWEN', 'WOWEN', 'XOWEN', 'BOXEN', 'EOXEN', 'FOXEN', 'IOXEN', 'JOXEN', 'KOXEN', 'NOXEN', 'OOXEN', 'POXEN', 'QOXEN', 'WOXEN', 'XOXEN']

Clutch Wordle Solver with known inputs

Sometimes when you're playing Wordle, you get to your fifth guess and you can't figure out the word any more, so you start mentally running through the list of remaining iterations, both sensical and nonsensical trying to figure out what those last few letters are.

The task here is to create all permutations of a final Wordle guess to save me from having to do it in my head, with the following rules:

General rules:

  • Wordle rules apply. All guesses are exactly 5 letters
  • Since Wordle only uses valid English words, only letters that appear on a standard English keyboard (a-z) need to be tested. However, you should include all valid permutations, not just valid English words, in your output
  • Solution is case insensitive.

Input:

  • A list of letters and indices (0 or 1 indexed, your choice), indicating the location of confirmed/green letters;
  • A list of letters and indices (consistently indexed), indicated yellow letters (i.e. the letter is known to not be at that index);
  • A list/string of letters that are yet to be guessed.

Note, green and yellow letters may still appear in more than the known positions. For example, if the input for green is [('E', 1)], there may still be an E in an index other than 1 as well.

Output:

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes (but must appear at least once in the output), and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

To confirm the list, in each case you can multiply the possible letters for each slot by the number of possible letters in all of the other slots (slot 1 * slot 2 * slot 3 * slot 4 * slot 5). (removed because I realized this is not the case if there are yellow letters)

What's the shortest way to solve this problem? You may take input and output in any convenient method or format, and the shortest code in bytes wins.


Example:

  1. Green Guesses (1 indexed): O=2, E=4, N=5
  2. Yellow Guesses: N!=3 (E!=5 is excluded because we know N=5)
  3. Unguessed Letters: Q, W, I, P, F, J, K, X, B

Output would be a list of all possible permutations given the known information, such as:

BEFIJKNOPQWX
BOBENEOBENFOBENIOBENJOBENKOBENNOBENOOBENPOBENQOBENWOBENXOBEN
BOEENEOEENFOEENIOEENJOEENKOEENNOEENOOEENPOEENQOEENWOEENXOEEN
BOFENEOFENFOFENIOFENJOFENKOFENNOFENOOFENPOFENQOFENWOFENXOFEN
BOIENEOIENFOIENIOIENJOIENKOIENNOIENOOIENPOIENQOIENWOIENXOIEN
BOJENEOJENFOJENIOJENJOJENKOJENNOJENOOJENPOJENQOJENWOJENXOJEN
BOKENEOKENFOKENIOKENJOKENKOKENNOKENOOKENPOKENQOKENWOKENXOKEN
BOOENEOOENFOOENIOOENJOOENKOOENNOOENOOOENPOOENQOOENWOOENXOOEN
BOPENEOPENFOPENIOPENJOPENKOPENNOPENOOPENPOPENQOPENWOPENXOPEN
BOQENEOQENFOQENIOQENJOQENKOQENNOQENOOQENPOQENQOQENWOQENXOQEN
BOWENEOWENFOWENIOWENJOWENKOWENNOWENOOWENPOWENQOWENWOWENXOWEN
BOXENEOXENFOXENIOXENJOXENKOXENNOXENOOXENPOXENQOXENWOXENXOXEN

In this case, there are 12, 1, 11, 1, 1 potential outcomes for each slot, so the list should have 12*11 items or 132.

In code terms, the inputs may be given as:

  • [['O', 2], ['E', 4], ['N', 5]]
  • [['N', 3]]
  • "QWIPFJKXB"

and the output as:

['BOBEN', 'EOBEN', 'FOBEN', 'IOBEN', 'JOBEN', 'KOBEN', 'NOBEN', 'OOBEN', 'POBEN', 'QOBEN', 'WOBEN', 'XOBEN', 'BOEEN', 'EOEEN', 'FOEEN', 'IOEEN', 'JOEEN', 'KOEEN', 'NOEEN', 'OOEEN', 'POEEN', 'QOEEN', 'WOEEN', 'XOEEN', 'BOFEN', 'EOFEN', 'FOFEN', 'IOFEN', 'JOFEN', 'KOFEN', 'NOFEN', 'OOFEN', 'POFEN', 'QOFEN', 'WOFEN', 'XOFEN', 'BOIEN', 'EOIEN', 'FOIEN', 'IOIEN', 'JOIEN', 'KOIEN', 'NOIEN', 'OOIEN', 'POIEN', 'QOIEN', 'WOIEN', 'XOIEN', 'BOJEN', 'EOJEN', 'FOJEN', 'IOJEN', 'JOJEN', 'KOJEN', 'NOJEN', 'OOJEN', 'POJEN', 'QOJEN', 'WOJEN', 'XOJEN', 'BOKEN', 'EOKEN', 'FOKEN', 'IOKEN', 'JOKEN', 'KOKEN', 'NOKEN', 'OOKEN', 'POKEN', 'QOKEN', 'WOKEN', 'XOKEN', 'BOOEN', 'EOOEN', 'FOOEN', 'IOOEN', 'JOOEN', 'KOOEN', 'NOOEN', 'OOOEN', 'POOEN', 'QOOEN', 'WOOEN', 'XOOEN', 'BOPEN', 'EOPEN', 'FOPEN', 'IOPEN', 'JOPEN', 'KOPEN', 'NOPEN', 'OOPEN', 'POPEN', 'QOPEN', 'WOPEN', 'XOPEN', 'BOQEN', 'EOQEN', 'FOQEN', 'IOQEN', 'JOQEN', 'KOQEN', 'NOQEN', 'OOQEN', 'POQEN', 'QOQEN', 'WOQEN', 'XOQEN', 'BOWEN', 'EOWEN', 'FOWEN', 'IOWEN', 'JOWEN', 'KOWEN', 'NOWEN', 'OOWEN', 'POWEN', 'QOWEN', 'WOWEN', 'XOWEN', 'BOXEN', 'EOXEN', 'FOXEN', 'IOXEN', 'JOXEN', 'KOXEN', 'NOXEN', 'OOXEN', 'POXEN', 'QOXEN', 'WOXEN', 'XOXEN']
added 131 characters in body
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes (but must appear at least once in the output), and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

To confirmTo confirm the list, in each case you can multiply the possible letters for each slot by the number of possible letters in all of the other slots (slot 1 * slot 2 * slot 3 * slot 4 * slot 5). (removed because I realized this is not the list, in each case you can multiply the possible letters for each slot by the number of possibleif there are yellow letters in all of the other slots (slot 1 * slot 2 * slot 3 * slot 4 * slot 5).

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes, and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

To confirm the list, in each case you can multiply the possible letters for each slot by the number of possible letters in all of the other slots (slot 1 * slot 2 * slot 3 * slot 4 * slot 5).

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes (but must appear at least once in the output), and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

To confirm the list, in each case you can multiply the possible letters for each slot by the number of possible letters in all of the other slots (slot 1 * slot 2 * slot 3 * slot 4 * slot 5). (removed because I realized this is not the case if there are yellow letters)

added 1586 characters in body
Source Link
  • Wordle rules apply. All guesses must beare exactly 5 letters
  • Since Wordle only uses valid English words, only letters that appear on a standard English keyboard (a-z) need to be tested. However, you should include all valid permutations, not just valid English words, in your output
  • Solution is case insensitive.
  • A list of letters and indices (0 or 1 indexed, your choice), indicating the location of confirmed/green letters;
  • A list of letters and indices (consistently indexed), indicated yellow letters (i.e. the index is a known location the letter is not;known to not be at that index);
  • A list/string of letters that are yet to be guessed.

Note, green and yellow letters may still appear in more than the known positions. For example, if the input for green is [('E', 1)], there may still be an E in an index other than 1 as well.

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes, and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

What's the shortest way to solve this problem? You may take input and output in any convenient method or format, and the shortest code in bytes wins.

In this case, there are 12, 1, 11, 1, 1 potential outcomes for each slot, so the list should have 12*11 items or 132.

In code terms, the inputs may be given as:

  • [['O', 2], ['E', 4], ['N', 5]]
  • [['N', 3]]
  • "QWIPFJKXB"

and the output as:

['BOBEN', 'EOBEN', 'FOBEN', 'IOBEN', 'JOBEN', 'KOBEN', 'NOBEN', 'OOBEN', 'POBEN', 'QOBEN', 'WOBEN', 'XOBEN', 'BOEEN', 'EOEEN', 'FOEEN', 'IOEEN', 'JOEEN', 'KOEEN', 'NOEEN', 'OOEEN', 'POEEN', 'QOEEN', 'WOEEN', 'XOEEN', 'BOFEN', 'EOFEN', 'FOFEN', 'IOFEN', 'JOFEN', 'KOFEN', 'NOFEN', 'OOFEN', 'POFEN', 'QOFEN', 'WOFEN', 'XOFEN', 'BOIEN', 'EOIEN', 'FOIEN', 'IOIEN', 'JOIEN', 'KOIEN', 'NOIEN', 'OOIEN', 'POIEN', 'QOIEN', 'WOIEN', 'XOIEN', 'BOJEN', 'EOJEN', 'FOJEN', 'IOJEN', 'JOJEN', 'KOJEN', 'NOJEN', 'OOJEN', 'POJEN', 'QOJEN', 'WOJEN', 'XOJEN', 'BOKEN', 'EOKEN', 'FOKEN', 'IOKEN', 'JOKEN', 'KOKEN', 'NOKEN', 'OOKEN', 'POKEN', 'QOKEN', 'WOKEN', 'XOKEN', 'BOOEN', 'EOOEN', 'FOOEN', 'IOOEN', 'JOOEN', 'KOOEN', 'NOOEN', 'OOOEN', 'POOEN', 'QOOEN', 'WOOEN', 'XOOEN', 'BOPEN', 'EOPEN', 'FOPEN', 'IOPEN', 'JOPEN', 'KOPEN', 'NOPEN', 'OOPEN', 'POPEN', 'QOPEN', 'WOPEN', 'XOPEN', 'BOQEN', 'EOQEN', 'FOQEN', 'IOQEN', 'JOQEN', 'KOQEN', 'NOQEN', 'OOQEN', 'POQEN', 'QOQEN', 'WOQEN', 'XOQEN', 'BOWEN', 'EOWEN', 'FOWEN', 'IOWEN', 'JOWEN', 'KOWEN', 'NOWEN', 'OOWEN', 'POWEN', 'QOWEN', 'WOWEN', 'XOWEN', 'BOXEN', 'EOXEN', 'FOXEN', 'IOXEN', 'JOXEN', 'KOXEN', 'NOXEN', 'OOXEN', 'POXEN', 'QOXEN', 'WOXEN', 'XOXEN']
  • Wordle rules apply. All guesses must be exactly 5 letters
  • Since Wordle only uses valid English words, only letters that appear on a standard English keyboard (a-z) need to be tested.
  • Solution is case insensitive.
  • A list of letters and indices (0 or 1 indexed, your choice), indicating the location of confirmed/green letters;
  • A list of letters and indices (consistently indexed), indicated yellow letters (i.e. the index is a known location the letter is not;
  • A list/string of letters that are yet to be guessed.

Note, green and yellow may still appear in more than the known positions.

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes, and the words consist of only the green, yellow, and remaining letters. The output may be in any order

What's the shortest way to solve this problem? You may take input and output in any convenient method or format.

In this case, there are 12, 1, 11, 1, 1 potential outcomes for each slot, so the list should have 12*11 items or 132.

  • Wordle rules apply. All guesses are exactly 5 letters
  • Since Wordle only uses valid English words, only letters that appear on a standard English keyboard (a-z) need to be tested. However, you should include all valid permutations, not just valid English words, in your output
  • Solution is case insensitive.
  • A list of letters and indices (0 or 1 indexed, your choice), indicating the location of confirmed/green letters;
  • A list of letters and indices (consistently indexed), indicated yellow letters (i.e. the letter is known to not be at that index);
  • A list/string of letters that are yet to be guessed.

Note, green and yellow letters may still appear in more than the known positions. For example, if the input for green is [('E', 1)], there may still be an E in an index other than 1 as well.

All potential "words" of exactly 5 letters, such that the green letters are in the indicated indexes, the yellow letters are not in the indicated indexes, and the words consist of only the green, yellow, and remaining letters. The output may be in any order.

What's the shortest way to solve this problem? You may take input and output in any convenient method or format, and the shortest code in bytes wins.

In this case, there are 12, 1, 11, 1, 1 potential outcomes for each slot, so the list should have 12*11 items or 132.

In code terms, the inputs may be given as:

  • [['O', 2], ['E', 4], ['N', 5]]
  • [['N', 3]]
  • "QWIPFJKXB"

and the output as:

['BOBEN', 'EOBEN', 'FOBEN', 'IOBEN', 'JOBEN', 'KOBEN', 'NOBEN', 'OOBEN', 'POBEN', 'QOBEN', 'WOBEN', 'XOBEN', 'BOEEN', 'EOEEN', 'FOEEN', 'IOEEN', 'JOEEN', 'KOEEN', 'NOEEN', 'OOEEN', 'POEEN', 'QOEEN', 'WOEEN', 'XOEEN', 'BOFEN', 'EOFEN', 'FOFEN', 'IOFEN', 'JOFEN', 'KOFEN', 'NOFEN', 'OOFEN', 'POFEN', 'QOFEN', 'WOFEN', 'XOFEN', 'BOIEN', 'EOIEN', 'FOIEN', 'IOIEN', 'JOIEN', 'KOIEN', 'NOIEN', 'OOIEN', 'POIEN', 'QOIEN', 'WOIEN', 'XOIEN', 'BOJEN', 'EOJEN', 'FOJEN', 'IOJEN', 'JOJEN', 'KOJEN', 'NOJEN', 'OOJEN', 'POJEN', 'QOJEN', 'WOJEN', 'XOJEN', 'BOKEN', 'EOKEN', 'FOKEN', 'IOKEN', 'JOKEN', 'KOKEN', 'NOKEN', 'OOKEN', 'POKEN', 'QOKEN', 'WOKEN', 'XOKEN', 'BOOEN', 'EOOEN', 'FOOEN', 'IOOEN', 'JOOEN', 'KOOEN', 'NOOEN', 'OOOEN', 'POOEN', 'QOOEN', 'WOOEN', 'XOOEN', 'BOPEN', 'EOPEN', 'FOPEN', 'IOPEN', 'JOPEN', 'KOPEN', 'NOPEN', 'OOPEN', 'POPEN', 'QOPEN', 'WOPEN', 'XOPEN', 'BOQEN', 'EOQEN', 'FOQEN', 'IOQEN', 'JOQEN', 'KOQEN', 'NOQEN', 'OOQEN', 'POQEN', 'QOQEN', 'WOQEN', 'XOQEN', 'BOWEN', 'EOWEN', 'FOWEN', 'IOWEN', 'JOWEN', 'KOWEN', 'NOWEN', 'OOWEN', 'POWEN', 'QOWEN', 'WOWEN', 'XOWEN', 'BOXEN', 'EOXEN', 'FOXEN', 'IOXEN', 'JOXEN', 'KOXEN', 'NOXEN', 'OOXEN', 'POXEN', 'QOXEN', 'WOXEN', 'XOXEN']
Updated some of the rules
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21
Loading
Updated some of the rules
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21
Loading
added 312 characters in body
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21
Loading
added 312 characters in body
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21
Loading
added 397 characters in body
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21
Loading
Source Link
Catija Staff
  • 301
  • 1
  • 8
  • 21
Loading