<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jason M. Heim on Medium]]></title>
        <description><![CDATA[Stories by Jason M. Heim on Medium]]></description>
        <link>https://medium.com/@jasonmheim?source=rss-27fd27acaded------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JDLt3C1Z_YWJuZ5ukw_DJg.jpeg</url>
            <title>Stories by Jason M. Heim on Medium</title>
            <link>https://medium.com/@jasonmheim?source=rss-27fd27acaded------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:19:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jasonmheim/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Winning Wordle’s Hard Mode]]></title>
            <link>https://medium.com/@jasonmheim/winning-wordles-hard-mode-c6b2a7aa5f1?source=rss-27fd27acaded------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6b2a7aa5f1</guid>
            <category><![CDATA[wordle]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jason M. Heim]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 20:23:27 GMT</pubDate>
            <atom:updated>2022-01-30T14:44:36.215Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a follow up to <a href="https://medium.com/@jasonmheim/a-weekend-with-wordle-fab51546c851">A Weekend with Wordle</a>, a retrospective I wrote after tinkering on a solver for Wordle. After sharing with friends and colleagues, someone suggested I let my solver play in “hard mode” and see what happens.</p><p>My first thought was, “what’s hard mode?!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*da-7fyt5xh4cl8YIC0k2hQ.png" /><figcaption>No idea how I missed this</figcaption></figure><h3>Normal vs. hard mode</h3><p>In normal mode you’re free to guess any word at any time, which means that you can “burn” a guess that <em>you know will be wrong</em>, but will give you more clues to the solution. For example, let’s say that you guess the word CHEST as your first word, and Wordle responds as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*UkG-jKwzPMKS2d_FvTUxCQ.png" /><figcaption>In hard mode, this is trouble</figcaption></figure><p>Based on these clues, you might be thinking that the solution ends with “TCH”. There are other possible words, but that combination causes trouble.</p><p>The problem is that there are a <em>lot</em> of words that end in TCH that are still potential solutions. HATCH, PATCH, BATCH, LATCH, BUTCH, DUTCH, HUTCH, PITCH, WITCH, DITCH, HITCH, BOTCH, NOTCH, and so on are all potential solutions. You could guess one of these and hope to get lucky, but in the worst case you’ll keep missing and run out of guesses.</p><p>In normal mode, you can pick a word that <em>does not</em> contain “TCH” and narrow things down more quickly. A word like AUDIO will cover all four remaining vowels in one guess.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yzKJf0sGZeHbQkwONzesA.png" /><figcaption>Now, we know the only vowel is an A</figcaption></figure><p>Now you can reasonably assume the word ends in “ATCH”. Unfortunately, there are still at least six such words: BATCH, HATCH, LATCH, MATCH, PATCH, WATCH. So we’re still in a state where random guessing from just these words could lose. Fortunately we still have four guesses left, so we can burn another word in order to narrow this down more. The leading letters on the words above are: B, H, L, M, P, W. Cover as many of these as possible with a word like BLIMP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PP96hj3p4epaEI763pwsIA.png" /><figcaption>This narrows things down a lot</figcaption></figure><p>Even in this worst case where we missed every letter, we managed to eliminate four of the six words that it could be. Now, we can safely guess from HATCH or LATCH, since they’re the only two words left.</p><p><strong>Hard mode does not let you do this!</strong> In this mode, any letters you match have to be used in subsequent guesses. In particular, any green letters have to stay in that same green spot for each guess after that.</p><h3>Revisiting my “normal mode” solvers</h3><p>All three of my existing solvers that worked for normal mode fail in hard mode. As noted before, I define a “valid” solution as one that can solve every game using six or fewer guesses.</p><p>Unfortunately, even my best scoring algorithm had problems. For 8 of the 2315 possible solutions, it needed seven or eight guesses. That’s a 99.7% win rate, which is pretty good, but not quite good enough.</p><p>For example, it takes eight guesses when the solution is HOVER:</p><pre>First guess: TRACE<br>Worst game: HOVER; [[&quot;TRACE&quot;:_o__o], [&quot;SILER&quot;:___MM], [&quot;FEWER&quot;:_._MM], [&quot;DUPER&quot;:___MM], [&quot;GOMER&quot;:_M_MM], [&quot;BORER&quot;:_M.MM], [&quot;JOKER&quot;:_M_MM], [&quot;HOVER&quot;:MMMMM]]<br>Average score: 3.61036717062635<br>Games with 1 guesses: 1<br>Games with 2 guesses: 79<br>Games with 3 guesses: 998<br>Games with 4 guesses: 1028<br>Games with 5 guesses: 171<br>Games with 6 guesses: 30<br>Games with 7 guesses: 6<br>Games with 8 guesses: 2</pre><p>You can see how it gets stuck once it hits a match on “ER” at the end, and then matches the O on the second letter. There are too many words that fit this and the solver can’t burn a guess to narrow it down.</p><p>Again though, this algorithm gets pretty close, so from here on in, <strong>let’s call this the fallback algorithm</strong>, since it’s still quite good and can still be useful in certain circumstances.</p><p><em>Side note: my solver prints </em><em>M for a match, </em><em>o for a letter that’s present in another position, </em><em>_ for a letter that is not in the target, and </em><em>. for an “overflow” letter, where it’s present in the target word but it’s a duplicate letter that was already represented.</em></p><h3>Clarifying the rules</h3><p>Let’s back up. Before I could run any tests in hard mode, I had to replicate the way it works. The instructions say “Any revealed hints must be used in subsequent guesses.” The question is, what’s a “revealed hint”? For example:</p><ul><li>Can you reuse a grey result letter? Knowing that it’s eliminated is a hint.</li><li>If a letter shows up yellow, can you use it again in the same spot? You know that it’s in the wrong position, which is a hint.</li></ul><p>If you experiment with Wordle’s UI (use incognito mode to start over), you’ll find that not all hints are enforced:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQ1wVSWW0MsvDjkKkom6Vg.png" /><figcaption>This is allowed in hard mode</figcaption></figure><p>To be clear, in this situation it’s a very bad idea to guess HEARS right after guessing HEART. I’m only testing this so that I can get the rules right in code:</p><ul><li>If a letter is green, it has to continue being green.</li><li>If a letter is present but elsewhere, you have to continue including it, <em>but you don’t have to move it</em>.</li><li>If a letter is absent, you can still use it again if necessary.</li></ul><h3>Adapting to hard mode</h3><p>Once you understand <em>why</em> hard mode is hard, you can adapt accordingly. Since my fallback algorithm can’t win every game yet, it makes sense to look for pitfalls and find ways to avoid them.</p><p><strong>The most obvious pitfall is a situation where you have four matched letters, but not enough guesses left to cover all the potential last letters.</strong></p><p>To help make this clearer I wrote a simple loop to take the set of possible solutions and build a custom map that identified overlaps of four letters. To keep things simple I focused only on exact match overlaps. Handling four exact matches is both easy to code and fast. First, just add a method that takes a string and converts itself to a list of strings with a “wildcard” in each position:</p><pre>/** <br> * &quot;Fractures&quot; a String into five &quot;shards&quot;, one for each index, with <br> * a wildcard &#39;*&#39; in each index. For example, convert &quot;TEACH&quot; into<br> * &quot;*EACH&quot;, &quot;T*ACH&quot;, &quot;TE*CH&quot;, &quot;TEA*H&quot;, and &quot;TEAC*&quot;.<br> */  <br>fun String.fracture(): List&lt;String&gt; {<br>    return listOf(0, 1, 2, 3, 4).map {<br>        val chars = toCharArray()<br>        chars[it] = &#39;*&#39;<br>        String(chars)<br>    }<br>}</pre><p>Now you can quickly fracture every possible word and use these shards as keys in a Map&lt;String, Set&lt;String&gt;&gt;:</p><pre>val collisionMap = mutableMapOf&lt;String, MutableSet&lt;String&gt;&gt;()<br>possibleWords.forEach { word -&gt;<br>    word.fracture().forEach {shard -&gt;<br>        collisionMap.getOrPut(shard) { mutableSetOf() }.add(word)<br>    }<br>}</pre><p><em>(Note: I’m still new to Kotlin, I’m sure there are more elegant ways to do these)</em></p><p>So now, given a list of possible words remaining, I can find the pitfalls. If you start with all possible words and print this map in ascending order by the size of the collected set, you’ll see that there are several sets of seven or more words that collide:</p><pre>*OWER=[SOWER, POWER, LOWER, TOWER, COWER, MOWER, ROWER]<br>*ATCH=[HATCH, WATCH, CATCH, LATCH, PATCH, BATCH, MATCH]<br>SHA*E=[SHAKE, SHAME, SHADE, SHARE, SHAPE, SHALE, SHAVE]<br>*OUND=[POUND, ROUND, FOUND, MOUND, SOUND, BOUND, WOUND, HOUND]<br>*IGHT=[LIGHT, NIGHT, MIGHT, EIGHT, WIGHT, SIGHT, FIGHT, RIGHT, TIGHT]</pre><p>Since we only have six guesses, <strong>using any of these words as a first guess would be guaranteed to have at least one loss</strong>.</p><p>This isn’t the whole story though. Remember that there is a whole set of words that are not possible solutions, but are allowed as guesses. Since there are also plenty of sets of six, it’s possible that one of the allowed words would collide with one of those, which would guarantee a loss, since there would only be five guesses left! So now we have to look at the sets of six words:</p><pre>GRA*E=[GRADE, GRATE, GRAVE, GRACE, GRAPE, GRAZE]<br>*ATTY=[BATTY, PATTY, TATTY, FATTY, RATTY, CATTY]<br>*AUNT=[JAUNT, TAUNT, GAUNT, HAUNT, DAUNT, VAUNT]<br>S*ORE=[STORE, SWORE, SCORE, SPORE, SHORE, SNORE]<br>*ASTE=[WASTE, PASTE, CASTE, HASTE, TASTE, BASTE]<br>STA*E=[STALE, STAGE, STARE, STAKE, STAVE, STATE]<br>*ILLY=[SILLY, DILLY, FILLY, BILLY, HILLY, WILLY]</pre><p>Each of these words is technically safe, since we have six guesses. However, if one of the allowed guesses that is not in this list collides with these they would guarantee a loss.</p><h4>Attempt 1: Keep the same algorithm, just avoid pitfalls</h4><p>Given the map of shards to their sets, we can avoid this specific type of trap by excluding these words from our potential first guess.</p><p>From there, this check can work continuously as the game progresses. Once you know the score of your first guess, the list of remaining possible solutions shrinks. Since building the collision map is cheap, I didn’t bother trying to maintain it as the game progressed, I just rebuild it after each guess, and then build two sets of shards to avoid:</p><pre>/** <br> * Any word that fractures into one of these shards <br> * should be avoided.<br> */<br>val shardsToAvoid =<br>    collisionMap.entries.filter { <br>        it.value.size &gt; guessesRemaining <br>    }.map { it.key }.toSet()<br> <br>/**<br> * Any word that is not in the &quot;possible solutions&quot;<br> * set and fractures into one of these shards<br> * should be avoided.<br> */<br>val nonPossibleShardsToAvoid =<br>    collisionMap.entries.filter {<br>        it.value.size == guessesRemaining<br>    }.map { it.key }.toSet()</pre><p>After that its’ easy to add a filter that avoids troublesome words:</p><pre>}.filter { word -&gt;<br>    word.fracture().none { shard -&gt;<br>        shardsToAvoid.contains(shard) || <br>                (nonPossibleShardsToAvoid.contains(shard) &amp;&amp;<br>                        !possibleWords.contains(word))<br>    }<br>}</pre><p><strong>RESULTS: Fail</strong></p><p>The word that my algorithm prefers as a first guess, TRACE, is not in this list, so that stays unchanged. However, the new filter creates causes the program to reach a no-win situation. In my case this was when it tried to solve HATCH:</p><pre>Now analyzing: GameState(guesses=[[&quot;TRACE&quot;:o_oM_], [&quot;BRACT&quot;:__oMo], [&quot;COACT&quot;:._oMo], [&quot;EPACT&quot;:__oMo], [&quot;TALCS&quot;:oM_M_], [&quot;TALCY&quot;:oM_M_]], hardMode=true), with 3 possible words remaining.<br>Exception in thread &quot;main&quot; java.util.NoSuchElementException: Collection is empty.</pre><p>It’s an interesting bug. Since there are no guesses remaining, the new filter will not allow any possible word to be guessed, because every possible word will at least match with itself in the collisionMap.</p><p>I hacked in a fix where, if the filter removes all guesses, then retry with the filter disabled. This prevents crashing, allowing the game to fail more gracefully by continuing to guess until it finally wins.</p><h4>Attempt 2: Same as Attempt 1 but cheat on the first guess</h4><p>This is “cheating” in the sense that the algorithm isn’t picking the first guess directly, rather we can just scan the list of all allowed guesses and keep trying until one of them doesn’t fail. To get here I added some code to handle a loss more gracefully.</p><p><strong>RESULTS: Fail (even with additional cheating!)</strong></p><p>This might have worked, but running a full test across every possible first word was slow enough that I got bored and killed it. If you give my algorithm the first guess, it can take up to 15 seconds to test it to see if it wins every game. Since there are roughly 12,972 possible words and no parallelization (running this locally on a laptop), that adds up to many many hours of wait time. Since Wordle changes every 24 hours, I’d have to set up a distributed pipeline to process these in parallel and finish in a reasonable time.</p><p>There has to be a better way. To learn more, I revisited the worst collisions:</p><pre>*OWER=[SOWER, POWER, LOWER, TOWER, COWER, MOWER, ROWER]<br>*ATCH=[HATCH, WATCH, CATCH, LATCH, PATCH, BATCH, MATCH]<br>SHA*E=[SHAKE, SHAME, SHADE, SHARE, SHAPE, SHALE, SHAVE]<br>*OUND=[POUND, ROUND, FOUND, MOUND, SOUND, BOUND, WOUND, HOUND]<br>*IGHT=[LIGHT, NIGHT, MIGHT, EIGHT, WIGHT, SIGHT, FIGHT, RIGHT, TIGHT]</pre><p>I pulled out the unique letters from each set and arranged them as follows, looking for overlaps:</p><pre>SPLTCMR   -&gt;   C     LM PRST<br>HWCLPBM   -&gt;  BC   H LM P<br>KMDRPLV   -&gt;    D   KLM PR  V<br>PRFMSBWH  -&gt;  B   FH  M PRS  W<br>LNMEWSFRT -&gt;     EF  LMN RST W<br>Overlaps:     2211221451443212</pre><p><strong>In theory, I can break up collisions by guessing words that use as many letters from these sets as possible. </strong>Based on the counts above, the most common letter overlaps are M, L, P, R, and S. The only vowel is E. The only words I could think of from these letters were PERMS and SPERM.</p><p>This did not go well:</p><pre>First guess: PERMS<br>Worst game: GOLLY; [[&quot;PERMS&quot;:_____], [&quot;TONAL&quot;:_M__o], [&quot;DOWLY&quot;:_M_MM], [&quot;COALY&quot;:_M_MM], [&quot;FONLY&quot;:_M_MM], [&quot;COOLY&quot;:_M.MM], [&quot;DOILY&quot;:_M_MM], [&quot;DOYLY&quot;:_M.MM], [&quot;LOWLY&quot;:oM_MM], [&quot;JOLLY&quot;:_MMMM], [&quot;HOLLY&quot;:_MMMM], [&quot;GOLLY&quot;:MMMMM]]<br>Average score: 3.7321814254859613<br>Games with 2 guesses: 50<br>Games with 3 guesses: 807<br>Games with 4 guesses: 1222<br>Games with 5 guesses: 205<br>Games with 6 guesses: 24<br>Games with 7 guesses: 3<br>Games with 8 guesses: 1<br>Games with 10 guesses: 1<br>Games with 11 guesses: 1<br>Games with 12 guesses: 1<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>It lost seven games, and <strong>in one case it took 12 guesses</strong>.</p><p>I was hand-crafting the first guess based on which word would “break up” collisions the best, which is really just falling back on the a clumsy and arbitrary scoring mechanism. I burned more time trying to come up with more-and-more convoluted ways to prioritize finding these letters, but this became too tedious and frustrating.</p><h4>Attempt 3: Prioritize breaking up collisions</h4><p>Back to the drawing board!</p><p><strong>It’s not enough to just avoid the biggest collisions</strong>. My best “normal mode” algorithm worked because it chooses words that do the best job of breaking up the problem space into smaller and smaller pieces. For this attempt, I looked for ways to do something similar, but with a <strong>focus on the getting the collisions sets to be smaller than the number of guesses remaining</strong>.</p><p>The goal isn’t necessarily to eliminate collision sets entirely. If we have enough guesses remaining to guess every word in a collision, then we’re safe. So the first thing we want to do is just find all the collision sets that are too big. This is easy, since we already have the code for it. We just need to make it usable as part of the analysis, not just at the start. That gives me this function:</p><pre>fun findCollisions(<br>    wordSet: Set&lt;String&gt;, <br>    maxSize: Int<br>): Map&lt;String, Set&lt;String&gt;&gt; {<br>    val resultMap = mutableMapOf&lt;String, MutableSet&lt;String&gt;&gt;()<br>    wordSet.forEach { word -&gt;<br>        word.fracture().forEach {shard -&gt;<br>            resultMap.getOrPut(shard) { mutableSetOf() }.add(word)<br>        }<br>    }<br>    // Filter out collision sets that are safely small,<br>    // and while we&#39;re here, make the result immutable.<br>    return resultMap.entries.filter {<br>        it.value.size &gt;= maxSize<br>    }.map { it.key to it.value.toSet() }.toMap()<br>}</pre><p>Now that we can use this as a general utility method, we can use it to <strong>evaluate how well each guess does with reducing the collisions</strong>. If we reach a point where all of the collision sets are “safe”, then we can switch to the fallback algorithm.</p><p>At the start of any game, our collision map looks like this:</p><pre>GRA*E=[GRADE, GRATE, GRAVE, GRACE, GRAPE, GRAZE]<br>*ATTY=[BATTY, PATTY, TATTY, FATTY, RATTY, CATTY]<br>*AUNT=[JAUNT, TAUNT, GAUNT, HAUNT, DAUNT, VAUNT]<br>S*ORE=[STORE, SWORE, SCORE, SPORE, SHORE, SNORE]<br>*ASTE=[WASTE, PASTE, CASTE, HASTE, TASTE, BASTE]<br>STA*E=[STALE, STAGE, STARE, STAKE, STAVE, STATE]<br>*ILLY=[SILLY, DILLY, FILLY, BILLY, HILLY, WILLY]<br>*OWER=[SOWER, POWER, LOWER, TOWER, COWER, MOWER, ROWER]<br>*ATCH=[HATCH, WATCH, CATCH, LATCH, PATCH, BATCH, MATCH]<br>SHA*E=[SHAKE, SHAME, SHADE, SHARE, SHAPE, SHALE, SHAVE]<br>*OUND=[POUND, ROUND, FOUND, MOUND, SOUND, BOUND, WOUND, HOUND]<br>*IGHT=[LIGHT, NIGHT, MIGHT, EIGHT, WIGHT, SIGHT, FIGHT, RIGHT, TIGHT]<br>Sum of all collision set sizes: 80</pre><p>So there are 80 words that have to be avoided as a first guess. The idea now is to find the word or words that give us the smallest set of word-to-avoid after the guess is done. Since each guess breaks up the problem space into smaller potential sets, we judge the guess by the worst of its results. To get here, we start by building up a map of “match score” to the set of words that all have the same match score:</p><pre>// Instead of just building a set, build a map of matches -&gt; set.<br>val matchMap = mutableMapOf&lt;List&lt;LetterMatch&gt;, MutableSet&lt;String&gt;&gt;()<br>possibleWords.forEach {<br>    val matchKey = word.tryGuess(it).matches<br>    matchMap.getOrPut(matchKey) { mutableSetOf() }.add(it)<br>}</pre><p>Now, matchMap contains all the sets of remaining possible words after guessing word. With that, we can compute the set of collisions for each of those sets, and report the biggest count of collision words:</p><pre>val maxCollisionCount = matchMap.entries.map { entry -&gt;<br>    // Use &quot;guessesRemaining - 1&quot; because matchMap was<br>    // produced after using one guess.<br>    val newCollisions = <br>        findCollisions(entry.value, guessesRemaining - 1)<br>    newCollisions.entries.sumBy { it.value.size }<br>}.max()</pre><p>As an intermediate step, I ran this over all allowed words. The “best worst” score that it found was 7. Unfortunately, there was a 27-way tie on this score:</p><pre>[CLITS, DERTH, FACTS, FRITH, HAINS, HANDS, HARDS, HARED, NOAHS, RATHS, ROWTH, SHAND, SOWTH, THANS, THAWY, THEGN, THRID, WROTH, FORTH, TRASH, FROTH, SLOTH, THIRD, WORTH, SHORT, BRASH, HEARD]</pre><p>But we’re not done! We also have the fallback algorithm, which we can use to choose from this set. The fallback algorithm still ties, but the resulting set is down to just 7 words:</p><pre>[FRITH, ROWTH, SOWTH, WROTH, FORTH, FROTH, WORTH]</pre><p>This is still more than I’d like, but it’s small enough that I can just run over all of the guesses and see if any of them are capable of winning every game by using the two algorithms combined.</p><p><strong>RESULTS: mixed</strong></p><p>Getting closer! Of the seven suggested first words, six of them failed, though just barely:</p><pre>Losses:<br>First guess: SOWTH<br>Worst game: BOXER; [[&quot;SOWTH&quot;:_M___], [&quot;DORMS&quot;:_Mo__], [&quot;COYER&quot;:_M_MM], [&quot;ROVER&quot;:.M_MM], [&quot;POKER&quot;:_M_MM], [&quot;GONER&quot;:_M_MM], [&quot;BOXER&quot;:MMMMM]]<br>Average score: 3.864794816414687<br>Games with 2 guesses: 54<br>Games with 3 guesses: 615<br>Games with 4 guesses: 1273<br>Games with 5 guesses: 338<br>Games with 6 guesses: 33<br>Games with 7 guesses: 2<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: WORTH<br>Worst game: FOYER; [[&quot;WORTH&quot;:_Mo__], [&quot;ROBED&quot;:oM_M_], [&quot;LORES&quot;:_MoM_], [&quot;COMER&quot;:_M_MM], [&quot;POKER&quot;:_M_MM], [&quot;GONER&quot;:_M_MM], [&quot;FOYER&quot;:MMMMM]]<br>Average score: 3.8475161987041036<br>Games with 1 guesses: 1<br>Games with 2 guesses: 56<br>Games with 3 guesses: 649<br>Games with 4 guesses: 1229<br>Games with 5 guesses: 350<br>Games with 6 guesses: 29<br>Games with 7 guesses: 1<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: WROTH<br>Worst game: COVER; [[&quot;WROTH&quot;:_oo__], [&quot;MORRA&quot;:_Mo._], [&quot;BONER&quot;:_M_MM], [&quot;SOLER&quot;:_M_MM], [&quot;POKER&quot;:_M_MM], [&quot;FOYER&quot;:_M_MM], [&quot;COVER&quot;:MMMMM]]<br>Average score: 3.8233261339092874<br>Games with 2 guesses: 50<br>Games with 3 guesses: 662<br>Games with 4 guesses: 1267<br>Games with 5 guesses: 320<br>Games with 6 guesses: 15<br>Games with 7 guesses: 1<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: FRITH<br>Worst game: JOKER; [[&quot;FRITH&quot;:_o___], [&quot;PURLS&quot;:__o__], [&quot;READY&quot;:oo___], [&quot;ROWME&quot;:oM__o], [&quot;BONER&quot;:_M_MM], [&quot;COVER&quot;:_M_MM], [&quot;JOKER&quot;:MMMMM]]<br>Average score: 3.819438444924406<br>Games with 2 guesses: 52<br>Games with 3 guesses: 661<br>Games with 4 guesses: 1275<br>Games with 5 guesses: 309<br>Games with 6 guesses: 16<br>Games with 7 guesses: 2<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: FORTH<br>Worst game: WAVER; [[&quot;FORTH&quot;:__o__], [&quot;CEDER&quot;:_._MM], [&quot;ABLER&quot;:o__MM], [&quot;YAGER&quot;:_M_MM], [&quot;MASER&quot;:_M_MM], [&quot;PAPER&quot;:_M_MM], [&quot;WAVER&quot;:MMMMM]]<br>Average score: 3.803887688984881<br>Games with 1 guesses: 1<br>Games with 2 guesses: 56<br>Games with 3 guesses: 665<br>Games with 4 guesses: 1296<br>Games with 5 guesses: 270<br>Games with 6 guesses: 25<br>Games with 7 guesses: 2<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: FROTH<br>Worst game: MATCH; [[&quot;FROTH&quot;:___oM], [&quot;CHETH&quot;:o._oM], [&quot;PITCH&quot;:__MMM], [&quot;BUTCH&quot;:__MMM], [&quot;CWTCH&quot;:._MMM], [&quot;LATCH&quot;:_MMMM], [&quot;MATCH&quot;:MMMMM]]<br>Average score: 3.7904967602591793<br>Games with 1 guesses: 1<br>Games with 2 guesses: 51<br>Games with 3 guesses: 672<br>Games with 4 guesses: 1326<br>Games with 5 guesses: 239<br>Games with 6 guesses: 25<br>Games with 7 guesses: 1<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>However, leading with <strong>ROWTH was able to win every game</strong>:</p><pre>Wins:<br>First guess: ROWTH<br>Worst game: BOOBY; [[&quot;ROWTH&quot;:_M___], [&quot;COMFY&quot;:_M__M], [&quot;GOLDY&quot;:_M__M], [&quot;POSEY&quot;:_M__M], [&quot;COBBY&quot;:_MoMM], [&quot;BOOBY&quot;:MMMMM]]<br>Average score: 3.857451403887689<br>Games with 2 guesses: 44<br>Games with 3 guesses: 657<br>Games with 4 guesses: 1228<br>Games with 5 guesses: 357<br>Games with 6 guesses: 29<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>So at this point, this is <em>sort of</em> a valid solution, <em>so long as you force the first guess to be ROWTH</em>.</p><p>The algorithm still recommends six words that ultimately fail, so to me, this is still a failure. Each failure is <em>so close</em> to a win, it seemed worthwhile to invest just a little more time on this to see if I could improve it just a bit more.</p><h4>Attempt 4: Proactively break up even more collisions</h4><p>Looking over the failures, there are some obvious patterns. There are several groupings of three letters that still trip up the algorithm: *O*ER, *A*ER, and **TCH.</p><p>For some time, I tried to figure out how to extend my approach to include three-letter matches like this. It’s tricky to reason about these. Obviously, computing the collisions on three-letter matches leads to much bigger collision sets. However, unlike four-letter matches, you are not constrained to just one new letter per guess. This makes it much more complicated to know whether a set is is actually a “trap” or if it can be managed by just being careful about guesses.</p><p>I did some testing to see what the three-letter collision sets would look like, and <strong>what stood out to me is that the big sets include combinations of large four-letter sets</strong>. For example, **TCH has 18 collisions:</p><pre>**TCH=[HATCH, DUTCH, RETCH, WATCH, BUTCH, HUTCH, CATCH, PITCH, NOTCH, HITCH, FETCH, LATCH, PATCH, BOTCH, DITCH, BATCH, WITCH, MATCH]</pre><p>Just looking at the first vowel, you can see some big subsets in here.</p><pre>*ATCH=[HATCH, WATCH, CATCH, LATCH, PATCH, BATCH, MATCH]<br>*ITCH=[PITCH, HITCH, DITCH, WITCH]<br>*UTCH=[DUTCH, BUTCH, HUTCH] </pre><p>This is one of the easier cases though. The biggest three letter collision set is *A*ER with 29 collisions:</p><pre>*A*ER=[PAPER, CATER, GAMER, PAYER, PARER, BAKER, SAFER, TAMER, HATER, EATER, PALER, LAYER, LATER, TAPER, CAPER, WAGER, RACER, LAGER, GAZER, SANER, WATER, MAKER, EAGER, RARER, WAVER, BALER, WAFER, GAYER, TAKER]</pre><p>Again, you can see plenty of subsets in there, e.g:</p><pre>*APER=[PAPER, TAPER, CAPER]<br>*ATER=[CATER, HATER, EATER, LATER, WATER]<br>*AYER=[PAYER, LAYER, GAYER]<br>*AKER=[BAKER, MAKER, TAKER]</pre><p>What’s missing from all this analysis is that these collisions sets are only made up of the “possible” words. There are many more allowed words than these, and none of those collisions are accounted for here.</p><p>It occurred to me here that <strong>I can make the collision breaker more aggressive simply by filtering out fewer sets when building the map of collisions to be used in scoring.</strong></p><p>This means a one-line change to the findCollisions() method:</p><pre>fun findCollisions(<br>    wordSet: Set&lt;String&gt;, <br>    maxSize: Int<br>): Map&lt;String, Set&lt;String&gt;&gt; {<br>    val resultMap = mutableMapOf&lt;String, MutableSet&lt;String&gt;&gt;()<br>    wordSet.forEach { word -&gt;<br>        word.fracture().forEach {shard -&gt;<br>            resultMap.getOrPut(shard) { mutableSetOf() }.add(word)<br>        }<br>    }<br>    // Filter out collision sets that are safely small,<br>    // and while we&#39;re here, make the result immutable.<br>    return resultMap.entries.filter {<br>        <strong>// HACK: reduce maxSize by 1 to be more aggressive!</strong><br>        it.value.size &gt;= maxSize - 1<br>    }.map { it.key to it.value.toSet() }.toMap()<br>}</pre><p><strong>RESULTS: WINNER!</strong></p><p>After the small adjustment to the findCollisions() method, the algorithm now recommends just two starting words: CLOTS and COLTS. <strong>Both of these words can win every game:</strong></p><pre>First guess: CLOTS<br>Worst game: STOVE; [[&quot;CLOTS&quot;:__Moo], [&quot;STONK&quot;:MMM__], [&quot;STORM&quot;:MMM__], [&quot;STOOD&quot;:MMM._], [&quot;STOUT&quot;:MMM_.], [&quot;STOVE&quot;:MMMMM]]<br>Average score: 3.838876889848812<br>Games with 2 guesses: 50<br>Games with 3 guesses: 668<br>Games with 4 guesses: 1214<br>Games with 5 guesses: 371<br>Games with 6 guesses: 12<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: COLTS<br>Worst game: FAVOR; [[&quot;COLTS&quot;:_o___], [&quot;DINGO&quot;:____o], [&quot;ARBOR&quot;:o._MM], [&quot;PAYOR&quot;:_M_MM], [&quot;MAJOR&quot;:_M_MM], [&quot;FAVOR&quot;:MMMMM]]<br>Average score: 3.8211663066954644<br>Games with 2 guesses: 51<br>Games with 3 guesses: 680<br>Games with 4 guesses: 1231<br>Games with 5 guesses: 338<br>Games with 6 guesses: 15<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>So there you have it. <strong>If you play hard mode and start with COLTS or CLOTS, you can win any game.</strong> The program runs end-to-end in under 2 minutes, which is fast enough for what I need.</p><p>Out of curiosity, I did try making the algorithm even more aggressive (subtract 2 from max size), which chose AROSE and ALTER as first words. Both of those words ended up losing pretty badly though, so I’d clearly gone too far.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6b2a7aa5f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Weekend with Wordle]]></title>
            <link>https://medium.com/@jasonmheim/a-weekend-with-wordle-fab51546c851?source=rss-27fd27acaded------2</link>
            <guid isPermaLink="false">https://medium.com/p/fab51546c851</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[wordle]]></category>
            <dc:creator><![CDATA[Jason M. Heim]]></dc:creator>
            <pubDate>Tue, 18 Jan 2022 22:39:41 GMT</pubDate>
            <atom:updated>2022-01-19T16:01:30.335Z</atom:updated>
            <content:encoded><![CDATA[<p>The viral success of <a href="https://www.powerlanguage.co.uk/wordle/">Wordle</a> is a healthy reminder that it’s possible to reach millions of people in a positive way with a simple, fun, and well-executed idea. Of course, I had to spoil it by tinkering with writing a “Solver” since I didn’t have anything urgent to do over the three-day weekend. The results were interesting enough to share, so here we go.</p><p>I’ll skip explaining the game here. If your’e not familiar, the best way to “get it” is to <a href="https://www.powerlanguage.co.uk/wordle/">just play it</a>. It runs in the browser, so there’s no need to install any apps, or deal with aggravating pop-up ads. Some of you may fondly remember that a lot of the internet used to be like this, but I digress…</p><p>As for “solving” this game, the problem space is simple* enough that you can write a decent solution without needing to chew up a lot of computing power. To me, any approach or algorithm that guarantees a “win” in 6 or fewer guesses is a valid solution.</p><p>From there, if you want, you can tinker further to try to find the “optimal” solver.</p><p><em>(*By “simple” I mean that there are only 2,315 possible solutions. Players can choose from an additional set of 10,657 words as guesses to help find letters more quickly, which makes for 30,030,180 combinations of “first guess” to potential target words. This is small enough that most algorithms to sift through all those options can fit in memory on a reasonably modern device.)</em></p><p>It’s been a while since I tinkered like this, so I had a bit of fun too. <strong>What surprised me is that the most optimal solution I found was also the easiest and cheapest.</strong></p><h3>The basics aren’t so basic</h3><p>Before trying to implement a “solver” algorithm it helps to start with some basic utility classes and functions:</p><ul><li>Write a function to compare an input word against a “target” word, producing a list of five “letter matches”. Wrap each letter match in a LetterMatch class that remembers the letter, index, and type of match. Wrap the input word and its matches in a Guess class.</li><li>Write a function that, given a Set&lt;Guess&gt;, tells you if a potential target word is still possible. Once you have at least one Guess, this can be used to divide up the remaining problem space. Note that I used a Set for this because you shouldn’t duplicate guesses, and <em>the order of guesses you’ve already made has no effect on what your next guess should be.</em></li><li>Write a function that checks an input word against Set&lt;Guess&gt;. This method should determine if the input word can offer any new information. For example, if the input word contains at least one letter that has not yet been used in any prior Guess, then using the input word will tell us new information about that letter.</li></ul><p>Armed with these the rest of the work gets a lot easier and a lot more fun, but…</p><h4>Wordle’s UI cleverly hides information in plain sight</h4><p>I expected to spend most of my time tinkering with scoring methods. As it turned out, I spent the bulk of this time chasing down bugs in my “basic” utility methods. Because of how it handles repeated letters, the output from matching a guess to a target is more nuanced than the instructions suggest:</p><figure><img alt="Screenshot of the instructions for playing Wordle" src="https://cdn-images-1.medium.com/max/510/1*Eyw_YLS_jJtCD2fFVW1A-A.png" /><figcaption>Wordle’s instructions</figcaption></figure><p>Matches are highlighted in green. Letters that are in the target word, but misplaced, are highlighted in yellow. Letters that aren’t in the target word are highlighted as grey. When I print a LetterMatch in code, I represent these with M, o, and _, respectively. So WEARY in the instructions looks like M____, PILLS looks like _o___, and VAGUE looks like _____.</p><p>It gets more complicated though if a word has repeated letters, like EERIE or TENET. If EERIE is the target, then guessing TENET would look like _M_o_. If you switch this, guessing EERIE for TENET would look like oM___.</p><p>These two guesses have similar looking scores, but the second guess produced an interesting bit of extra information. EERIE has the letter ‘E’ three times, but TENET only has it twice, so when the third E is matched, it’s shown as _.</p><p>So while the instructions tell us that a grey letter means “not in the target word”, that’s not the whole story. In fact, if you write your code to interpret things this way, you will have pretty severe bugs. Similarly, a naive scoring method might yield oM__o when guessing EERIE on TENET, which will also cause bugs since that’s not how Wordle does things.</p><p>When you guess EERIE for TENET, the last E shows up as grey, but ‘E’ is present in the target word. The extra information we get from this is that <em>the target word has </em><strong><em>exactly two </em></strong><em>of the letter E.</em></p><p>By contrast, when you guess TENET for EERIE, the result _M_o_ tells you that <em>the target word has </em><strong><em>at least two</em></strong><em> of the letter E. </em>This result is slightly less informative than its inverse. Since our goal is to learn as much as we can with each guess, it’s important to keep track of this distinction!</p><p>It gets cumbersome to continuously check for this edge case if your only notation options are M, o, and _. So in code, I made things easier for myself by adding a fourth type of match called “overflow”, which means that the letter is present in the target word but the guessed word has too many of that letter. When I print these, I use . for this. So now, guessing EERIE for TENET would look like oM__.. Guessing EERIE for BEAST would look like .M__..</p><p><strong>With this extra notation, it gets a lot easier to write checks that filter out words that are no longer possible</strong>. For example, if we know the target word has exactly one E in it, then we can eliminate TENET and EERIE as possible targets!</p><h3>Scoring approaches</h3><p>Once I was convinced that I’d ironed out the bugs in my utility methods, I started tinkering with different ways to score each possible guess. This part was a lot more fun.</p><p>I cooked up a variety of ways to “score” an input word against the remaining possible targets. At the start of any game, there are 2,315 possible targets and 12,972 potential input words. We have no information about the target word yet, but each time we make a Guess, we narrow down the problem space, until we either get lucky and match the target, or reduce the remaining possible words down to one.</p><p>You can make your “score” function an abstraction, and use a simple loop-of-loops to test every potential input word against every possible target word. Choose the input word that scores the best, and you know which word (or words, in the case of a tie) should be tried next.</p><p>You can apply this recursively, so long as you trim the set of possible target words based on the results of the Guesses you’ve made.</p><h4>Option 1: Fewest Remaining Possible Words</h4><p>This approach is expensive, but given how thorough it is, I also expected it would be tough to beat. It’s a valid solution, since it solves every target with six or fewer guesses, but turned out to not to produce the best average score.</p><p>The basic idea is to test each input word against all possible remaining targets, and compute how many valid targets remain after the resulting Guess. The largest remaining target set in this loop indicates the worst case result. So we “score” a guess by the size of that set.</p><p>After that, we just pick the lowest of those scores, since in this algorithm, a lower score is better.</p><p>As psuedo-Kotlin:</p><pre>val firstGuess = allGuessWords.map { word -&gt;<br>  val largestRemainingSetSize = allTargets.map { target-&gt;<br>    val guess = word.tryGuess(target)<br>    val newValidRemainingTargetCount =<br>        allTargets.filter { target -&gt;<br>            guess.isStillPossible(target) <br>        }.size()<br>  }.max()<br>  WordScore(word, largestRemainingSetSize)<br>}.minBy { wordScore -&gt; wordScore.score }</pre><p>Some quick notes:</p><ul><li>In reality, there can be ties, so tracking the “best worst” in the outer loop is useful so that you can collect a set of all the ties.</li><li>Early iterations took multiple hours to run because I wanted to fully compute the score of every word and output that as a sorted map, which would show me both the best and worst first guesses. If you track the “best worst” as you go, you can speed this up by several orders of magnitude; just break the inner loop whenever you encounter a score that is larger (worse) than the best worst seen up to that point. You can’t get a full ranking of every first possible guess this way, but you get your best guess a <strong>lot</strong> faster.</li><li>To make this trivially fast, we could make an assumption that the worst case will always be a no-match result, _____ , and skip the inner loop entirely. I did not try this, it just came to mind as I wrote this, so I’ll leave that as an exercise for the reader…</li><li>The real code I wrote can be used in a recursive function and takes prior guesses into account. I made a “GameState” class that has a Set&lt;Guess&gt; and this is what implements the isStillPossible() method. The pseudo-code in this post skips this for brevity.</li></ul><p><strong>RESULTS</strong></p><p>This algorithm produced a five way tie for a recommended first guess:</p><p>AESIR, REAIS, SERAI, ARISE, RAISE</p><p>Unsurprisingly, these all contain the same five letters. If you guess any of these words, then the worst case will be a no-match result, <strong>which will leave behind only 168 possible target words</strong>. So at worst, you’ve cut down the possible remaining targets from 2,315 to 168, eliminating almost 93%!</p><p>After adding the optimizations mentioned above, I was able to use my solver recursively and test each of these guesses against all possible targets and see how they performed in aggregate. Here are the results, sorted by lowest average score:</p><pre>First guess: RAISE<br>Worst game: WOOER; [[&quot;RAISE&quot;:o___o], [&quot;OUTED&quot;:o__M_], [&quot;CHAWK&quot;:___o_], [&quot;AMOLE&quot;:__M_o], [&quot;WOOER&quot;:MMMMM]]<br>Average score: 3.642764578833693<br>Games with 1 guesses: 1<br>Games with 2 guesses: 42<br>Games with 3 guesses: 833<br>Games with 4 guesses: 1346<br>Games with 5 guesses: 93<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: ARISE<br>Worst game: LAPEL; [[&quot;ARISE&quot;:o___o], [&quot;ETHAL&quot;:o__oM], [&quot;ABAMP&quot;:o_._o], [&quot;PANEL&quot;:oM_MM], [&quot;LAPEL&quot;:MMMMM]]<br>Average score: 3.6591792656587474<br>Games with 1 guesses: 1<br>Games with 2 guesses: 31<br>Games with 3 guesses: 840<br>Games with 4 guesses: 1327<br>Games with 5 guesses: 116<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: AESIR<br>Worst game: JAUNT; [[&quot;AESIR&quot;:o____], [&quot;CANTY&quot;:_Moo_], [&quot;DIGHT&quot;:____M], [&quot;AJIVA&quot;:oo__.], [&quot;JAUNT&quot;:MMMMM]]<br>Average score: 3.6786177105831532<br>Games with 2 guesses: 39<br>Games with 3 guesses: 774<br>Games with 4 guesses: 1394<br>Games with 5 guesses: 108<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: REAIS<br>Worst game: GONER; [[&quot;REAIS&quot;:oo___], [&quot;COTED&quot;:_M_M_], [&quot;MAWKY&quot;:_____], [&quot;BAGHS&quot;:__o__], [&quot;GONER&quot;:MMMMM]]<br>Average score: 3.6829373650107993<br>Games with 2 guesses: 35<br>Games with 3 guesses: 778<br>Games with 4 guesses: 1388<br>Games with 5 guesses: 114<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: SERAI<br>Worst game: PAPER; [[&quot;SERAI&quot;:_ooo_], [&quot;AGLET&quot;:o__M_], [&quot;CONKY&quot;:_____], [&quot;ADVEW&quot;:o__M_], [&quot;PAPER&quot;:MMMMM]]<br>Average score: 3.687257019438445<br>Games with 2 guesses: 32<br>Games with 3 guesses: 786<br>Games with 4 guesses: 1371<br>Games with 5 guesses: 126<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>This brute-force analysis suggests using RAISE as your first word, with an average score of ~3.64, solving every possible game in five guesses or less. Pretty good!</p><p><strong>ROOM FOR IMPROVEMENT</strong></p><p>To see how well this did, I peeked at the average score and suggested first words that were produced by other folks who wrote their own solvers. It didn’t take long to find better average scores. On a whim, I decided to try using their recommended first guesses to see how they would score when using Option 1’s algorithm. It turned out that Option 1 works better with the suggestions from other algorithms! Some examples:</p><pre>First guess: SOARE<br>Worst game: PAPER; [[&quot;SOARE&quot;:__ooo], [&quot;AGLET&quot;:o__M_], [&quot;RUMPY&quot;:o__o_], [&quot;ACRED&quot;:o_oM_], [&quot;PAPER&quot;:MMMMM]]<br>Average score: 3.618574514038877<br>Games with 2 guesses: 31<br>Games with 3 guesses: 929<br>Games with 4 guesses: 1247<br>Games with 5 guesses: 108<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: RAINE<br>Worst game: WOOER; [[&quot;RAINE&quot;:o___o], [&quot;OGEES&quot;:o_.M_], [&quot;CHAWK&quot;:___o_], [&quot;CLOMP&quot;:__M__], [&quot;WOOER&quot;:MMMMM]]<br>Average score: 3.6198704103671706<br>Games with 2 guesses: 38<br>Games with 3 guesses: 899<br>Games with 4 guesses: 1283<br>Games with 5 guesses: 95<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: RAILE<br>Worst game: WOOER; [[&quot;RAILE&quot;:o___o], [&quot;OGEES&quot;:o_.M_], [&quot;CHAWK&quot;:___o_], [&quot;AMORT&quot;:__Mo_], [&quot;WOOER&quot;:MMMMM]]<br>Average score: 3.628941684665227<br>Games with 2 guesses: 35<br>Games with 3 guesses: 880<br>Games with 4 guesses: 1309<br>Games with 5 guesses: 91<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: ROATE<br>Worst game: JAUNT; [[&quot;ROATE&quot;:__oo_], [&quot;CLINT&quot;:___MM], [&quot;DIGHT&quot;:____M], [&quot;AJIVA&quot;:oo__.], [&quot;JAUNT&quot;:MMMMM]]<br>Average score: 3.628941684665227<br>Games with 2 guesses: 34<br>Games with 3 guesses: 859<br>Games with 4 guesses: 1354<br>Games with 5 guesses: 68<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: COATE<br>Worst game: POUND; [[&quot;COATE&quot;:_M___], [&quot;GLORY&quot;:__o__], [&quot;BUMFS&quot;:_o___], [&quot;AHEAP&quot;:____o], [&quot;POUND&quot;:MMMMM]]<br>Average score: 3.634989200863931<br>Games with 2 guesses: 32<br>Games with 3 guesses: 863<br>Games with 4 guesses: 1338<br>Games with 5 guesses: 82<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>All of these performed better than RAISE, despite scoring lower as a first guess according to the algorithm. The best performer so far, SOARE, scored worse as a first guess because its worst case leaves 183 possible words instead of 168.</p><p>All this being said, it’s worth noting that <strong>with a good first guess this algorithm is guaranteed to solve any Wordle game in 5 guesses or less.</strong></p><p>But it’s still clearly not “optimal”, at least not in terms of lowest average score. There’s more to the game than just getting the smallest worst case set, which led to the next attempt…</p><h4>Option 2: Fewest Remaining Letters to Guess</h4><p>This method takes Option 1 as a starting point, and but then tries to add some nuance to how the remaining possible word set is scored.</p><p>Option 1 just uses the size of the remaining possible word set. To build on this, I took the remaining possible word set and dug into what letters are found, and where. My theory was that the more we reduce the remaining possible letters, the easier it will be to get to the solution.</p><p>Since letters from the guesses are expected to be in the remaining possible set, I tried to normalize things a bit by removing any letter/index pairs that were already part of the input word.</p><p>In pseudo-Kotlin:</p><pre>val firstGuess = allGuessWords.map { word -&gt;<br>  val remainingLetterCount = allTargets.map { target-&gt;<br>    val guess = word.tryGuess(target)<br>    val remainingTargets = allTargets.filter { target -&gt;<br>        guess.isStillPossible(target) <br>    }.toSet()<br>    // Get the letters/index combos we already guessed<br>    val removeThese = guess.letterMatches.map {<br>       // &#39;indexedLetter&#39; returns an IndexedValue&lt;Char&gt;<br>       // from the LetterMatch<br>       it.indexedLetter() <br>    }.toSet()<br>    // Count how many indexed letters are left.<br>    remainingTargets.map { target -&gt;<br>        // This gets IndexedValue&lt;Char&gt; as well.<br>        target.toList().withIndex()<br>    }.flatten().toSet().filter { <br>        !removeThese.contains(it) <br>    }.toSet().size<br>  }.max()<br>  WordScore(word, remainingLetterCount)<br>}.minBy { wordScore -&gt; wordScore.score }</pre><p><strong>RESULTS</strong></p><p>This algorithm recommends RAINE as the first guess (no ties). What’s fascinating is that this guess was tested with Option 1’s algorithm and beat all five of Option 1’s recommendations. <strong>This suggests that the best algorithm may depend on the current state</strong>, e.g. use strategy X for the first guess but strategy Y for all subsequent guesses.</p><p>This is supported by feeding this first guess into the Option 2 algorithm; RAINE scores significantly worse as a first guess using Option 2 than it did with Option 1:</p><pre>First guess: RAINE<br>Worst game: HOVER; [[&quot;RAINE&quot;:o___o], [&quot;OUTED&quot;:o__M_], [&quot;COWKS&quot;:_M___], [&quot;HEXYL&quot;:Mo___], [&quot;HOMER&quot;:MM_MM], [&quot;HOVER&quot;:MMMMM]]<br>Average score: 3.6725701943844493<br>Games with 2 guesses: 40<br>Games with 3 guesses: 874<br>Games with 4 guesses: 1206<br>Games with 5 guesses: 194<br>Games with 6 guesses: 1<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>With Option 1’s algorithm, RAINE’s average score is 3.620, which means that Option 1 does a better job using this first guess. So… what happens if we pass RAISE into Option 2?</p><pre>First guess: RAISE<br>Worst game: MOVER; [[&quot;RAISE&quot;:o___o], [&quot;OGEED&quot;:o_.M_], [&quot;CHAWK&quot;:_____], [&quot;BEVER&quot;:_.MMM], [&quot;LOVER&quot;:_MMMM], [&quot;MOVER&quot;:MMMMM]]<br>Average score: 3.6989200863930884<br>Games with 1 guesses: 1<br>Games with 2 guesses: 41<br>Games with 3 guesses: 838<br>Games with 4 guesses: 1213<br>Games with 5 guesses: 218<br>Games with 6 guesses: 4<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>RAISE did better with Option 1.</p><p>While it did yield a better first guess, Option 2 seems to perform slightly worse on average than Option 1 once your first guess is made. That being said, it is a valid solution. It will choose RAINE to start and solve all but one target word with five or fewer guesses and the remaining case is solved in six.</p><h4>Option 3: Best Aggregate “Score”</h4><p>I won’t expand much on this because it created more problems than it solved. The basic idea was to give each type of match a weighted value, e.g. 0 for no match anywhere in the word, 4 for right letter, wrong position, 10 for an exact match, etc. Tally up all of the points, pick whichever is best after testing a first guess against all possible solutions.</p><p>I spent some time trying to tune the weights, But wasn’t able to get this to be a valid solution. It was prone to have games needing too many guesses. It’s possible I just needed to invest more time on this, but it got boring so I abandoned it.</p><h4>Option 4: Best Result Set Variety</h4><p>This method takes a different path to trying to find the most effective first guess. Instead of computing the largest remaining set, just compare every possible first guess against every possible target, and collect the resulting LetterMatch lists into a set, i.e. a Set&lt;List&lt;LetterMatch&gt;&gt;.</p><p>The theory is that bigger result sets mean more variety, and more variety means that the set of possible solutions is broken up into more “buckets”. Don’t even bother checking the size of each bucket, we can try that later if needed. Since the set of possible solutions is a fixed size, <em>having more buckets means that the average size of each bucket is smaller</em>.</p><p>The worst hypothetical case would be a word that is made up entirely of letters that don’t appear in any target word. This hypothetical word would evaluate to _____ for every target word. Since every List&lt;LetterMatch&gt; would be the same, the resulting Set&lt;List&lt;LetterMatch&gt;&gt; would only have one entry.</p><p>The best hypothetical case would yield a unique list of matches for each possible solution; the size of the Set&lt;List&lt;LetterMatch&gt;&gt; would be the same as the size of the set of potential targets, and you’d be able to <em>solve every game in just two guesses</em>. Of course that isn’t feasible in reality (there are at most 1024 buckets, but 2315 words), but the idea still seemed pretty sound.</p><p>This approach is both very fast and very easy to implement. It looks something like the pseudo-Kotlin code below. Note that this scoring algorithm favors <strong>higher</strong> scores, so we use maxBy instead of minBy:</p><pre>val firstGuess = allGuessWords.map { word -&gt;<br>  letterMatchListSet = allTargets.map { target -&gt;<br>    word.tryGuess(target).letterMatches<br>  }.toSet()<br>  WordScore(word, letterMatchListSet.size)<br>}.maxBy { wordScore -&gt; wordScore.score }</pre><p>It’s so simple and crude, this can’t be effective, can it?</p><p><strong>RESULTS</strong></p><p>This algorithm recommends TRACE as a first word (no ties). This word produces 150 unique lists of matches. Other words that score well on this metric are:</p><ul><li>SALET: 148</li><li>REAST: 147</li><li>CARTE: 146</li><li>CARET: 145</li></ul><p>Note that TRACE, CARTE, and CARET all have the same letters, but TRACE does a better job of dividing into more buckets so it scores the best.</p><p>Contrast with Option 1. All of these words scored the same, and quite poorly. Where RAISE scored 168, TRACE scored 246 (recall that lower is better in Option 1).</p><p>So according to Option 1, these are terrible first guesses. But what counts is letting Option 4 play all the games and see what happens. On this metric, <strong>Option 4 absolutely crushes Option 1</strong>:</p><pre>First guess: TRACE<br>Worst game: BOXER; [[&quot;TRACE&quot;:_o__o], [&quot;DINES&quot;:___M_], [&quot;LUMPY&quot;:_____], [&quot;ROWTH&quot;:oM___], [&quot;JOKER&quot;:_M_MM], [&quot;BOXER&quot;:MMMMM]]<br>Average score: 3.488120950323974<br>Games with 1 guesses: 1<br>Games with 2 guesses: 51<br>Games with 3 guesses: 1157<br>Games with 4 guesses: 1031<br>Games with 5 guesses: 73<br>Games with 6 guesses: 2<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>While this does have two games that require six tries, <strong>this solution solves more than half of the games in three or fewer guesses!</strong> This brings its average score down quite a bit to just 3.488, well below the best score I’d seen to this point (3.619 for SOARE with Option 1).</p><p>I also tested using some of the other best-scoring first guesses to see how they performed:</p><pre>First guess: REAST<br>Worst game: CHILL; [[&quot;REAST&quot;:_____], [&quot;COLIN&quot;:M_oo_], [&quot;BIFID&quot;:_o_._], [&quot;CLICK&quot;:MoM._], [&quot;CHILL&quot;:MMMMM]]<br>Average score: 3.488120950323974<br>Games with 2 guesses: 47<br>Games with 3 guesses: 1153<br>Games with 4 guesses: 1053<br>Games with 5 guesses: 62<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: SALET<br>Worst game: ROVER; [[&quot;SALET&quot;:___M_], [&quot;NIDOR&quot;:___oM], [&quot;WHOMP&quot;:__o__], [&quot;CORBY&quot;:_Mo__], [&quot;AGAVE&quot;:___oo], [&quot;ROVER&quot;:MMMMM]]<br>Average score: 3.491144708423326<br>Games with 2 guesses: 55<br>Games with 3 guesses: 1126<br>Games with 4 guesses: 1079<br>Games with 5 guesses: 52<br>Games with 6 guesses: 3<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: CARTE<br>Worst game: ROVER; [[&quot;CARTE&quot;:__o_o], [&quot;FINDS&quot;:_____], [&quot;LUMPY&quot;:_____], [&quot;BAWKS&quot;:_____], [&quot;AARGH&quot;:__o__], [&quot;ROVER&quot;:MMMMM]]<br>Average score: 3.4980561555075593<br>Games with 2 guesses: 52<br>Games with 3 guesses: 1126<br>Games with 4 guesses: 1072<br>Games with 5 guesses: 62<br>Games with 6 guesses: 3<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: CARET<br>Worst game: BOXER; [[&quot;CARET&quot;:__oM_], [&quot;DINGS&quot;:_____], [&quot;ROUPY&quot;:oM___], [&quot;WHELM&quot;:__o__], [&quot;JOKER&quot;:_M_MM], [&quot;BOXER&quot;:MMMMM]]<br>Average score: 3.5041036717062637<br>Games with 2 guesses: 52<br>Games with 3 guesses: 1115<br>Games with 4 guesses: 1078<br>Games with 5 guesses: 69<br>Games with 6 guesses: 1<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>Interestingly, REAST has a slightly different score distrubiont but has <em>exactly</em> the same average score as TRACE. Also, REAST <em>never needs six guesses</em>, though it never gets the lucky first-guess either, since it is not in the list of possible targets.</p><p>The other words are ranked as slightly worse, and in the same order that they were scored as a first guess.</p><p>For completeness sake, I tried some of the recommended first guesses from exploring Options 1 and 2: RAINE, RAISE, and SOARE:</p><pre>First guess: RAINE<br>Worst game: BOOBY; [[&quot;RAINE&quot;:_____], [&quot;PLUSH&quot;:_____], [&quot;WEDGY&quot;:____M], [&quot;EBBET&quot;:_oo__], [&quot;BOOBY&quot;:MMMMM]]<br>Average score: 3.51792656587473<br>Games with 2 guesses: 39<br>Games with 3 guesses: 1101<br>Games with 4 guesses: 1112<br>Games with 5 guesses: 63<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: SOARE<br>Worst game: BOOBY; [[&quot;SOARE&quot;:_M___], [&quot;CUNIT&quot;:_____], [&quot;GOOLD&quot;:_MM__], [&quot;ABBAS&quot;:_oo__], [&quot;BOOBY&quot;:MMMMM]]<br>Average score: 3.521814254859611<br>Games with 2 guesses: 33<br>Games with 3 guesses: 1123<br>Games with 4 guesses: 1077<br>Games with 5 guesses: 82<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>First guess: RAISE<br>Worst game: GONER; [[&quot;RAISE&quot;:o___o], [&quot;DETER&quot;:_._MM], [&quot;BLOWY&quot;:__o__], [&quot;VOUCH&quot;:_M___], [&quot;AJUGA&quot;:___o_], [&quot;GONER&quot;:MMMMM]]<br>Average score: 3.524406047516199<br>Games with 1 guesses: 1<br>Games with 2 guesses: 41<br>Games with 3 guesses: 1089<br>Games with 4 guesses: 1114<br>Games with 5 guesses: 67<br>Games with 6 guesses: 3<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>All of these perform significantly better than they did in Option 1 or 2, but not as well as TRACE or RAINE.</p><p>One last thing: Option 1 thinks that TRACE is a bad first guess, but what happens if we open with TRACE using Option 1’s algorithm?</p><pre>First guess: TRACE<br>Worst game: GONER; [[&quot;TRACE&quot;:_o__o], [&quot;SOLEI&quot;:_M_M_], [&quot;RHOMB&quot;:o_o__], [&quot;GOPAK&quot;:MM___], [&quot;GONER&quot;:MMMMM]]<br>Average score: 3.571922246220302<br>Games with 1 guesses: 1<br>Games with 2 guesses: 51<br>Games with 3 guesses: 972<br>Games with 4 guesses: 1205<br>Games with 5 guesses: 86<br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-</pre><p>Earlier I’d found that SOARE did the best with Option 1 by scoring 3.619, but I hadn’t considered TRACE since it had scored so poorly as a first word. This test proves that wrong, getting the average score down to 3.572!</p><h3>Conclusions and other notes</h3><p>First, huge kudos to Josh Wardle for creating Wordle. One of its best features is that it limits games to one per day, which gives it a similar vibe to solving a daily crossword puzzle, but with a lower time commitment. It also ensures that everyone is playing the same game, which makes sharing much more fun. Also, as someone with mild color blindness I appreciate the high contrast and dark mode options.</p><p>As for my solver, I’m quite happy with Option 4 and its suggested first guess of TRACE. My personal laptop is pretty old but Option 4 was able to compute the first guess and then play all 2315 games in about 45 seconds without any parallelism. Options 1 and 2 were much slower, especially before I added various short-circuit optimizations, and their results were not as good.</p><p>One of the more interesting solvers whose score I was trying to beat was <a href="https://aditya-sengupta.github.io/coding/2022/01/13/wordle.html">this solution by Aditya Sengupta</a>, which seems to share a lot with my Option 4. Aditya’s solution seeks to maximize “differential entropy” across the potential result buckets, whereas my Option 4 seeks to just maximize the number of buckets. While my algorithm is less sophisticated, it seems to perform better and chooses a different first word. That being said, I haven’t read this solution in depth enough to tell how the “overflow” case is being factored into the computation. My algorithm treats these separately from “not in the word”, which gives me 1024 (4⁵) potential buckets, where Aditya is dividing into 235 (3⁵) potential buckets. Since I have more potential buckets, I think I’m able to identify more variety, which is sort-of related to the “entropy” in Aditya’s solution.</p><p>Lastly, no discussion of Wordle would be complete without mentioning the “adversarial” version of Wordle called <a href="https://qntm.org/files/wordle/index.html">Absurdle</a> by <a href="https://qntm.org/">qntm</a>. “Adversarial” means that it “cheats” by leaving its options open until you can force it to choose from a single remaining possible word. I let my Option 4 play Absurdle, expecting to score 6, since that’s the result I get for BOXER. Happily, my algorithm wins in 5:</p><figure><img alt="Game of absurdle, guessing TRACE, SOILY, DOGMA, FAENA, PUPPY" src="https://cdn-images-1.medium.com/max/492/1*y7WE9ZVz6qVFzCHzy3SL_Q.png" /><figcaption>Option 4 wins a PUPPY!</figcaption></figure><p>With that, I’m happy to quit tinkering, and just play Wordle without the solver. That being said, I plan to open with TRACE until I see something that works better :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fab51546c851" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keep it together]]></title>
            <link>https://medium.com/@jasonmheim/keep-it-together-695cbd140e38?source=rss-27fd27acaded------2</link>
            <guid isPermaLink="false">https://medium.com/p/695cbd140e38</guid>
            <category><![CDATA[covid19]]></category>
            <dc:creator><![CDATA[Jason M. Heim]]></dc:creator>
            <pubDate>Sun, 22 Mar 2020 14:46:09 GMT</pubDate>
            <atom:updated>2020-03-22T14:46:09.675Z</atom:updated>
            <content:encoded><![CDATA[<p>“I gave you the wrong number before,” he says. “That’s her mobile number, she’s not using that since she can’t go outside. I’ll text you her landline.”</p><p>“Thanks, Pop.”</p><p>“Make sure to call her.” Even though he’s not using speakerphone I can hear Mom in the background, emphasizing how important it is to call.</p><p>We say goodbye and hang up. My dog hints that she needs to go outside and I oblige. It’s cool and sunny outside. It’s just past 3pm on a Saturday but the streets are empty because everything is closed. COVID-19 is about to shut down all “non-essential” businesses.</p><p>I walk past the barber shop. This is the last day they’re allowed to be open, but the chairs are empty and the barbers are idle. I could use a haircut, but is the luxury worth the risk? I want to support the local business. I want them to be there on the other side of this. Maybe I’ll come back later.</p><p>My phone buzzes in my pocket. Dad sent me my Grandmother’s landline. I tap the number and dial it. As it rings, the display reads out “Nana.” Apparently I had the number this whole time and was too lazy to look it up.</p><p>My siblings and I call her “Nana.”</p><p>As the phone rings my dog pulls left. A tall guy in a sweatsuit is coming the opposite way with an chihuahua bouncing on the end of its leash. I guide my dog to the right and pinch the phone to my ear with my shoulder.</p><p>Nana picks up and say “Hi Jason!”</p><p>“Hi Nana. How are you holding up?” How did she know it was me? Is Caller ID still a thing?</p><p>“Oh, I’m fine here. So good to hear from you. So good to be hearing from everyone. How are you? What’s it like there?”</p><p>She’s getting a lot of calls now. In normal times, the members of our family that live near her visit and keep her company, but the senior living facilities stopped allowing guests because of the virus. More of us are calling her now to help her feel less isolated.</p><p>I live hours away in New York City, and I didn’t even know I had her number in my phone.</p><p>“It’s strange here. I’m out walking my dog now, normally there’d be people everywhere, but it’s quiet. Empty.”</p><p>“Oh my. I can only imagine.” She laughs, but it’s a quiet, awkward laugh. “How are you keeping busy?”</p><p>“Well, I’m lucky, you know, I can do my work from home.” I stop short as the dog squats to pee. “A lot of places are closed though, we’re probably going to see a bunch of these places out of business before we get to the other side of this.” I give the dog a treat, pat her head, and start walking again.</p><p>“Everything is shut down here too.” She clears her throat. “I’ve never seen anything like this.”</p><p>“So how about you then? What keeps you busy?” The dog and I pause at the intersection even though there aren’t any cars coming.</p><p>“Oh I’ve got some books I’ve been meaning to read. I’ve been watching too much television. It’s dreadful.”</p><p>“How are you getting supplies? Do they deliver there for you?”</p><p>She pauses. “Um.”</p><p>I shouldn’t have asked that. She’s not allowed to drive anymore and from what I hear she didn’t take that well.</p><p>“Well,” she says, “I don’t think they have any new delivery options, but there’s a shuttle that’s still running. We use that to go to the market.”</p><p>“Oh that’s nice.”</p><p>The dog tugs on the leash, sniffing a lamppost and getting ready to squat again. I pull a poop bag off of the roll. The line is silent for a bit, so I ask her what she’s reading.</p><p>“I just started it, only a few chapters in.” She pauses. “It’s called, something like, <em>It Comes Back to You</em>, no wait that’s not it.”</p><p>She’s been having memory issues for a while now. She’s smart enough to know it and gets frustrated when something slips. I try to move the conversation along. “Are you enjoying it so far?”</p><p>“Yes, it’s interesting. It talks about, you know how,” she trails off. “Oh, darn it. I just had it.”</p><p>I’m making things worse. “What about hobbies? Is there anything I can send you that you enjoy?”</p><p>“What do you mean?”</p><p>“Well you know I’ve been playing guitar when I can, as long as it’s not too loud for Natalie. And she’s getting ready to start painting again.”</p><p>“Oh how fun. How is Natalie?” Her voice perks up again. She’s okay.</p><p>“Natalie’s doing well too. She can also work from home. She has her area in the apartment and I have mine so it’s almost like we’re still commuting.”</p><p>She laughs. “How long have you been married now?”</p><p>“It’ll be seventeen years in September.”</p><p>“My goodness how the time flies. How wonderful for you.”</p><p>“Yep, it’s all good. People are adapting here.” I pinch the phone to my ear again and bend down to pick up what the dog just left on the sidewalk.</p><p>“What do you mean?”</p><p>“Well, so like I went to the butcher shop earlier. It’s a small place and normally on a Saturday it’d be packed.” I tie off the poop bag and toss it in the trash can. “Today they are only letting in two or three at a time, and there’s a line outside. People are spread out too, lots of space in the line.”</p><p>“Wow how interesting.”</p><p>“Yeah people are taking this seriously now, but they’re not panic buying anymore. Store shelves are starting to get back to normal. They had plenty of pork at the shop too. They have the best sweet Italian sausage there.”</p><p>“Oh I’ll bet.”</p><p>“Yeah we’re gonna get through this if people keep this up.”</p><p>“Oh that’s so good. You sound good.”</p><p>“You do too, Nana.”</p><p>The dog and I circle back to head home. We pass a bar that is open for takeout. Apparently you can even get alcohol to go now. The sign outside says you can drink on the street, though I’m not sure that’s a thing. I kind of hope it’s not a thing.</p><p>“Well it’s been so good to hear from you.” She laughs for a moment and sighs.</p><p>“And you too, Nana. I’ll give you a call again later this week.”</p><p>“That’d be so great. Always good to hear from you Jake.”</p><p>Jake is my cousin. I don’t say anything, but she realizes it and corrects herself.</p><p>“I’m sorry, Jason, not Jake. Jason. And Natalie. Do send Natalie my love.” Her voice is tinged with frustration.</p><p>“Will, do Nana. I love you. Stay safe and let me know if you need anything?”</p><p>“Love you too, Jason. And Natalie. Love you too.”</p><p>We hang up as the dog and I turn the last corner toward home. The only people on the street are walking dogs or exercising, spacing ourselves apart, trying to keep it together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=695cbd140e38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Heart With Six Chambers]]></title>
            <link>https://medium.com/@jasonmheim/a-heart-with-six-chambers-5811957220c4?source=rss-27fd27acaded------2</link>
            <guid isPermaLink="false">https://medium.com/p/5811957220c4</guid>
            <category><![CDATA[theatre]]></category>
            <dc:creator><![CDATA[Jason M. Heim]]></dc:creator>
            <pubDate>Tue, 21 Aug 2018 22:30:01 GMT</pubDate>
            <atom:updated>2018-08-22T00:48:40.389Z</atom:updated>
            <content:encoded><![CDATA[<p>Farewell to Derek DelGaudio’s <em>In And Of Itself</em>.</p><p>Most people have a pair of ventricles and a pair of atria in their hearts. One atrium and one ventricle on each side, each partnership forming half of a vital organ and working in concert to keep us alive.</p><p>The atrium receives blood as input, holds it for a fraction of a moment and then passes it to a ventricle that will send it back out on a new mission. The right side takes in blood from the body and pumps it to the lungs to receive fresh oxygen. The left side takes the blood back from the lungs and sends it everywhere else.</p><p>I’ve seen the show <em>In And Of Itself </em>four times. Perhaps I needed one for each chamber in my heart. The first time was with my wife, the second with her and a dear group of friends. The third was with my brother. The last was just me and my wife again, the closing show on Sunday, August 19th. If I put one show in each chamber, the last goes in the left ventricle. It can’t just sit there. The heart has to send it everywhere else.</p><p>Given that the show has concluded, it seems appropriate to use past tense when discussing it. I can’t do that yet; the show is still circulating in me.</p><p>There’s something special about a show that changes every time you see it. Some changes are obvious, like the contributions that each new audience brings. Others are more subtle; they change because you as an observer have changed, because your perception has changed.</p><p>This is by design. If you tried to explain the show in one word, a lot of people would choose “identity.” When you go to see the show, you are first presented with a thousand cards that read “I AM” and something you are, or want to be, or could be. It depends on how you choose to interpret the task. The card I chose each time was different: HACKER, COMPOSER, POET, MINIMALIST.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mN943luRVD-O_6Z39Ttrxg.jpeg" /></figure><p>The show asks you to choose a label for yourself. By the end, you are challenged to think about how well that label fits, but also about all the things it misses.</p><p>DelGaudio performs a handful of amazing magic tricks, but it would be hard to call his performance a “magic show.” To do so would miss a lot, at least by modern interpretations of the term.</p><p>If you watch the <a href="https://vimeo.com/229568473">short video Invisible Dialogues</a> you can get a better sense of what’s happening. DelGaudio is not trying to subvert the idea of a magic show. He’s resurrecting its former purpose: to tell stories that really matter to people.</p><p>What could matter more to a person than who they are?</p><p>The parable of the <a href="https://en.wikipedia.org/wiki/Blind_men_and_an_elephant">blind men and the elephant</a> plays a big role in the show. Because the story is so familiar, I looked right past it on the first viewing. Even after the second and the third time, I didn’t really catch how well DelGaudio weaves this into the overall narrative.</p><p>On the surface, he is making a point about how perception can affect identity; how the things we perceive are limited to our senses, and how vital details are missed. But even though it was right in front of me the whole time, I did not realize that there was an elephant on the stage, hiding in plain sight. It lurked in one of the six displays that frame the entire show, but I was blind to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0zHkMDiGS3sbve5bsYgmw.jpeg" /><figcaption>pick a card, any card</figcaption></figure><p>The number six seems significant. In DelGaudio’s version of the parable there are <em>six</em> blind men. As the story goes, each of them tries to identify the elephant, and each of them get it wrong.</p><p>Elsewhere in the show is a story about Russian Roulette, a game played with a gun that can hold six bullets, each of which fails to fire.</p><p>These misfires are good fortune. To die is to be permanently labeled, or perhaps vice versa. So long as our luck holds out, the way we see ourselves can change.</p><p>The magic you get from multiple viewings is seeing how we can change without losing what we were before. We can be <em>all</em> the things we want to be. Different people see you in different ways. This is by design.</p><p>I can only assume that Derek DelGaudio is not like most people. I think his heart has an extra atrium, an extra ventricle, tasked with processing signals from within, pumping them out into the world.</p><p><em>In And Of Itself </em>tells a story that matters to me. It challenges me to think about what I want to be, and more importantly, what it means when someone sees me the way I see myself.</p><p>I’m sad this show is over, but if <a href="https://vimeo.com/229568473">magic is a synonym for hope</a>, then I hope it won’t be too long before this performer returns with something new. Something that I’ll have to see multiple times because I’m not smart enough to get it the first time.</p><p><em>Sincere thanks to Derek DelGaudio, Frank Oz, Neil Patrick Harris, and all who were involved in bringing the show to New York City.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5811957220c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>