Solving Wordle By Adding Machine Vision To A 3D Printer

Wordle bot

Truth be told, we haven’t jumped on the Wordle bandwagon yet, mainly because we don’t need to be provided with yet another diversion — we’re more than capable of finding our own rabbit holes to fall down, thank you very much. But the word puzzle does look intriguing, and since the rules and the interface are pretty simple, it’s no wonder we’ve seen a few efforts like this automated Wordle solver crop up lately.

The goal of Wordle is to find a specific five-letter, more-or-less-common English word in as few guesses as possible. Clues are given at each turn in the form of color-coding the letters to indicate whether they appear in the word and in what order. [iamflimflam1]’s approach was to attach a Raspberry Pi camera over the bed of a 3D printer and attach a phone stylus in place of the print head. A phone running Wordle is placed on the printer bed, and Open CV is used to find both the screen of the phone, as well as the position of the phone on the printer bed. From there, the robot uses the stylus to enter an opening word, analyzes the colors of the boxes, and narrows in on a solution.

The video below shows the bot in use, and source code is available if you want to try it yourself. If you need a deeper dive into Wordle solving algorithms, and indeed other variant puzzles in the *dle space, check out this recent article on reverse engineering the popular game.

Thanks to [Gene] for the tip.

19 thoughts on “Solving Wordle By Adding Machine Vision To A 3D Printer

  1. Certainly a nice approach for any Computer Vision project that requires an XYZ table. These have become so accessible it’s great, the best thing is that the printer parts don’t even need to work, making it even cheaper. As for the solving algorithm, it could use some work and optimize for entropy instead of repeating correct letters in the guess.

    1. I know it probably shouldn’t, but it never ceases to amaze me that some people seem fixated on the idea that once you’ve identified a correct letter in a correct position it _must_ be repeated in every subsequent play – that’s not in the rules. If you’re down to two guesses remaining and there are three or more possible words that fit, this strategy reduces it to a guessing game.

      Here’s an actual example: On the third play I reduced the word to _ATCH, which left me with BATCH, CATCH, HATCH, LATCH, MATCH and WATCH as possible answers, but only 3 plays left. If I follow the “common sense” method of sticking with known letters I have a 3 in 6 possibility of getting the correct word – a coin toss. But if I use the entropic approach I want to include or eliminate as many as possible of the letters B, C, H, L, M and W in the next play. C and H are difficult to eliminate because they would be doubled, but can be definitively eliminated if you use either of them as the first letter of the next play. L, M, B and W are good targets for quick elimination/identification.

      So the word CLIMB is the best next play, even though it’s not possible that it is the correct word. It will reduce the possibilities to 2 (if no letters match it’s HATCH or WATCH), or 1 (if C matches on position [green], or L, M, or B matches on letter only [yellow], it’s CATCH, LATCH, BATCH or MATCH and I know which one). This guarantees I will get the correct answer within 6 plays.

      The word was HATCH, BTW.

      1. It’s actually in the rules, but you have to go to settings and turn on hard mode: “Any revealed hints must be used in subsequent guesses”

        I don’t enjoy hard mode, as it feels more luck based once you hit the situation you describe, so I don’t play with it. Our group enjoys quordle, because it discourages the use of hard mode.

  2. Can y’all stop using run-on sentences?

    This thing:
    “The video below shows the bot in use, and source code is available if you want to try it yourself.”

    Should be two separate sentences:
    “The video below shows the bot in use. The source code is available if you want to try it yourself.”

    All the writing on Hackaday seems to use run-on sentences. It is getting old.

    1. The easiest way to fix a run-on is to split the sentence into smaller sentences using a period. The author should check, however, to make sure that this solution does not result in short, choppy sentences.
      Your example takes a sentence correctly using a coordinating conjunction and replaces it with two short, choppy sentences.

      See example 3 of “Correcting Run-On Sentences” at https://academicguides.waldenu.edu/writingcenter/grammar/runonsentences

        1. I disagree that they’re unrelated. As someone who read the article (instead of playing armchair editor), I was interested in seeing a proof of concept in action, and this sentence addressed exactly how I could do that.

          But that’s beside the point. You seem to have a fundamental misunderstanding of what defines a “run-on sentence”. A run-on sentence isn’t based on subjective interpretations, it’s a grammatical error, an issue with the structure of the sentence itself. It has nothing to do with the content of the sentences.

    2. If that’s what you consider a run-on sentence, you must have the reading comprehension of a 5 year old.

      In comparison, I’ve seen text messages that read more fluidly than your “corrected” version.

      1. It is a run on sentence because it composed of two separate sentences that don’t belong together. They are not thematically related – they have no business being stuck together.

        1. Interesting comments. After reading it, I get the notion of a short ‘list’. Here is this and that if you are interested type thing. Seems you may be able to mix topics in that case?

    1. I’d be more interested in adapting this to Golf Clash.
      Press down, then release when a needle swings to screen centre. Incorrect release makes a hook / slice shot, computer vision should allow for a perfect shot every time.

  3. The number of repeated letters on the video thumbnail is infuriating. That’s no way to shrink the search space.

    In the long tradition of HaD comments, this seems overcomplicated. I solve wordle with a 95 line shell script. Tradition aside, this seems like a great way to dip your toes into CV.

Leave a Reply to ChrisCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.