[HN Gopher] Play Wordle from Your Terminal
       ___________________________________________________________________
        
       Play Wordle from Your Terminal
        
       Author : conradludgate
       Score  : 144 points
       Date   : 2022-02-06 15:41 UTC (7 hours ago)
        
 (HTM) web link (crates.io)
 (TXT) w3m dump (crates.io)
        
       | ylyn wrote:
       | Looking at the source, this doesn't handle ambering of repeated
       | letters correctly:                   let mut diff =
       | [Match::Black; 5];              for (i, &b) in
       | input.iter().enumerate() {             if solution[i] == b {
       | diff[i] = Match::Green;             } else if
       | solution.contains(&b) {                 diff[i] = Match::Amber;
       | }         }
       | 
       | If the solution is "crest", for example, guessing "class" should
       | give green for the first s and black/grey for the second s, but
       | your implementation will give amber for the second s. And if you
       | guess "stars", then only the first s should be amber, and the
       | second should be black.
        
         | re wrote:
         | It's interesting to me how common this bug with the coloring of
         | repeated letters in guesses is in Wordle clones, as well as how
         | often there are disagreements in comments about what the
         | correct behavior should be.
         | 
         | IMO, this is something that ought to be called out in a
         | hypothetical formal specification of Wordle, but I kind of like
         | that it _isn 't_ mentioned in the instructions for the game,
         | from a gameplay/learning perspective. It encourages people to
         | reason through what the correct behavior ought to be on their
         | own, and to experiment to see how the implementation marks
         | guesses; the assumption that letters can't be repeated is one
         | that a lot of people don't realize that they're making.
         | 
         | https://news.ycombinator.com/item?id=30174386
         | 
         | https://news.ycombinator.com/item?id=30086083
         | 
         | https://news.ycombinator.com/item?id=29964725
         | 
         | https://news.ycombinator.com/item?id=29947881
         | 
         | https://news.ycombinator.com/item?id=29828652
         | 
         | https://news.ycombinator.com/item?id=29699516
         | 
         | https://news.ycombinator.com/item?id=30103848
        
           | IanCal wrote:
           | It's making me think that this will be a future
           | fizzbuzz/bowling pin/Roman numerals kind of example for
           | programming.
        
         | tsumnia wrote:
         | > this doesn't handle AMBERing of repeated letters correctly
         | 
         | Sigh... this game has ruined 5 letter words for me. Saw it and
         | immediately thought "how's that for an opener?"
        
         | conradludgate wrote:
         | Oh interesting. Fair enough. I didn't bother (or care enough)
         | how it handled multiple of the same letter. I might patch it
         | later
        
           | Biganon wrote:
           | This is a key behavior, without it the game is basically
           | useless
        
             | conradludgate wrote:
             | I'd disagree with this. Sampling bias but I do have a 100%
             | win streak average of 4 and I've never needed this
             | information to win
        
               | Jtsummers wrote:
               | You may not have needed that information, but if the game
               | marks both instances of the same letter as amber (correct
               | letter, wrong place), but there is only _one_ instance
               | then it has misled the player. That 's incorrect
               | behavior. The player should be able to discern from their
               | guess which letters and how many of them there are in the
               | solution. They shouldn't be led towards a wrong answer.
               | 
               | It's not a stellar plan, but if someone starts off with a
               | guess like "abyss" and there is only one 's', they
               | shouldn't be tricked by the game.
        
               | brewdad wrote:
               | Not to mention, if you play on hard mode, using that non-
               | existent second 's' is now required. I get that this
               | implementation doesn't have a hard mode, but most of my
               | friends play in hard mode, in practice, even if the box
               | isn't ticked on.
        
               | furyofantares wrote:
               | I get 3 quite often, and it's a major part of the game,
               | and probably the most fun/interesting consideration.
        
               | airstrike wrote:
               | You may disagree, but you're still wrong.
        
               | colinmhayes wrote:
               | It's a fact that this implementation is "useless" without
               | correct behavior for repeated letters? Seems like most
               | people wouldn't even notice.
        
               | [deleted]
        
               | airstrike wrote:
               | It's like implementing a chess game except your knight
               | moves 1 square forward + 1 square to the side instead of
               | 1+2. Sure, you can play it, but the game is wrong.
        
               | colinmhayes wrote:
               | More like a chess game where you can't do en passant. I
               | don't think that makes it useless.
        
               | pxx wrote:
               | Which makes it not chess; i.e. not fit for purpose. And
               | this omission is more on the scale of missing castling
               | than en passant. Some people who futz with two or so
               | moves will think it's "fine" but it's missing something
               | critical.
        
               | conradludgate wrote:
               | >> without it the game is basically useless
               | 
               | This is what I am disagreeing with. It's not useless. I
               | have and can play it just fine without that information.
               | 
               | I already have a fix implemented, but it was an extreme
               | statement that I was saying is wrong
        
               | airstrike wrote:
               | But that's the thing, you can't "play it just fine". You
               | can play a broken version of the game. Nobody is
               | interested in a game that is 90% correct.
               | 
               | And then on top of that you're being defensive when you
               | receive very valid feedback instead of gladly accepting
               | it. What's the point of even posting to HN if you're not
               | welcoming feedback?
        
               | conradludgate wrote:
               | When did I not accept the feedback? I fixed it. I said it
               | was interesting. I didn't accept that it was "unplayable"
               | which is hyperbole
        
               | csallen wrote:
               | You come off as somewhat defensive, dismissive, uncaring.
               | Which are normal and justifiable human emotions when
               | someone is criticizing your creations. But "the crowd"
               | really doesn't like to see them expressed. So it's a good
               | rule of thumb when posting these things in public to err
               | on the side of being gracious and grateful. Like it or
               | not, it's just good PR.
        
               | conradludgate wrote:
               | I agree in a sense, but I was initially responding to
               | someone who said the game was "useless" without this,
               | which in my experience is just not true and rude itself
               | (and most people I know don't understand the rules of how
               | it handles doubles)
               | 
               | The "didn't care" part was referring to my initial
               | research, and not the fix. In my top level comment, I
               | mentioned this was a quick couple hour project.
               | 
               | I didn't mind the initial criticism. Like I said before,
               | I found it interesting.
        
             | contravariant wrote:
             | For something that can only occur when the answer contains
             | a letter twice that seems a bit harsh.
        
               | iso1210 wrote:
               | First half a dozen or so times I did it I just assumed
               | you couldn't have a duplicate letter.
        
               | daemoens wrote:
               | Ironically, today's answer had the same letter twice.
        
               | dTal wrote:
               | Spoilers!!
        
               | CrazyStat wrote:
               | It is unnecessarily harsh, but the behavior is also
               | important if the answer contains a letter once but your
               | guess contains it twice, not only if the answer contains
               | it twice.
        
               | lozenge wrote:
               | That's not very CIVIC. I'll pay you a VISIT. After
               | calling my MUMMY. SORRY, just trying to be FUNNY.
        
           | cwackerfuss wrote:
           | I maintain an OSS wordle clone that has solved this problem
           | if you'd like to check it out as inspiration:
           | 
           | https://github.com/cwackerfuss/word-guessing-
           | game/blob/49279...
        
             | conradludgate wrote:
             | I already have a working fix, but thanks for offering
        
           | renewiltord wrote:
           | Fascinating how the perceived tone of the initial response
           | can change the outcome of the deepest thread. Sensitive
           | dependence on initial conditions. Human conversation meets
           | James Gleick's Chaos conditions!
        
       | dowakin wrote:
       | If you wonder why in the demo author uses `crane` as first guess
       | - check out recent video from 3Blue1Brown
       | 
       | https://www.youtube.com/watch?v=v68zYyaEmEA
        
         | conradludgate wrote:
         | It was a funny coincidence that I started working on this, and
         | then an hour later he released that video :)
        
       | js2 wrote:
       | This is missing one thing I find helpful in the web-based game.
       | The on-screen keyboard which colors the letters according to your
       | guesses which makes it a lot easier to plan your next guess.
        
         | conradludgate wrote:
         | There's now a keyboard that is shown to the side. I hope this
         | satisfies your needs
        
         | dTal wrote:
         | Use your shell!
         | 
         | echo abcdefghijklmnopqrstuvwxyz | tr -d 'adieu'
         | 
         | I do this anyway, because instead of the normal order I put the
         | alphabet in frequency order, so I get the list of letters in
         | the order I should be considering them.
         | 
         | It's possible to "cheat" quite a bit using the shell. Exactly
         | what does and doesn't count as "cheating" is up to your
         | personal comfort level. For example, the frequency analysis of
         | the official wordle word list is rather different than English
         | at large...
        
       | [deleted]
        
       | 0F wrote:
       | I was so shocked when my family member told me wordle is a
       | website and not an app. I never thought that the masses would go
       | for something like that in the package of a website. It really
       | gives me hope for the future.
        
         | rockostrich wrote:
         | Why? Publishing an app costs money even if the app is free
         | (which is why free apps usually have ads or some kind in-app
         | purchases). Publishing a website with static content can be
         | free depending on where you host it.
        
           | 0F wrote:
           | Because the model of apps needs to die. If you have something
           | you want to put out into the world you currently need to
           | write an android app, an iOS app and then any other native
           | formats you want to target. But it's much better to make it
           | browser based because it's one and done and it also side-
           | steps all the nonsense with app stores which has been well
           | known lately. If it's easier and better for the developers
           | then we will have more and better software.
           | 
           | Web assembly and WGPU are coming and when they do it will be
           | the next paradigm after mobile apps. But in order to get to
           | this new glorious paradigm it is necessary for people to be
           | capable of recognizing the value of software even if it's in
           | the browser and of using it on the scale seen with wordle.
           | It's just as likely that people would turn their nose up to a
           | browser based software and everything would remain stagnate.
           | So I am glad.
        
             | cableshaft wrote:
             | What about something like React Native? You get Web, iOS,
             | and Android with one codebase.
        
             | nojito wrote:
             | webapps are a privacy nightmare.
             | 
             | No thanks.
        
               | choward wrote:
               | Mobile apps are a privacy nightmare.
               | 
               | No thanks.
        
               | ccouzens wrote:
               | Just about anything that can connect to the internet is a
               | potential privacy nightmare. I assume that by specifying
               | "webapps" you're making a comparison to native apps.
               | 
               | Configure your browser to block 3rd party cookies and
               | you'll be fine.
               | 
               | It's nice to have the private window privacy feature.
               | That's a standard feature of web browsers, but I don't
               | know of any consumer operating system that makes this
               | easy for native apps.
        
               | Anthony-G wrote:
               | While they often are, there's no rule that web apps have
               | to be a privacy nightmare.
               | 
               | Thanks to Hacker News1, I recently came across _Learn
               | systemd by example_ 2. The site itself is hosted by
               | Hetzner, a German hosting provider that take user privacy
               | seriously3 and uses Cloudflare as a privacy-conscious
               | CDN4. The only third-party resources it uses are Google
               | fonts. Users of _uMatrix_ 5 or _uBlock Origin_ 6 can
               | easily block these resources and the web app works
               | perfectly fine without them.
               | 
               | I'd also use Wordle itself as an example of a reasonably
               | user-privacy friendly web application. The only third-
               | party resources it uses is Google Tag Manager (which is
               | blocked by default by uMatrix).
               | 
               | I use Firefox with a number of web extensions ( _Firefox
               | Multi-Account Containers_ 7, _Decentraleyes_ 8, _uMatrix_
               | , _uBlock Origin_ , _Privacy Redirect_ 9). These all
               | provide me, an end-user, much greater control over my
               | online privacy than I'd have with a mobile app. I've also
               | recommended Decentraleyes and uBlock Origin to non-
               | technical friends as extensions they can install and not
               | worry about configuration.
               | 
               | 1. https://news.ycombinator.com/item?id=30071240
               | 
               | 2. https://systemd-by-example.com/
               | 
               | 3. https://www.hetzner.com/legal/privacy-policy
               | 
               | 4. https://www.cloudflare.com/privacypolicy/
               | 
               | 5. https://github.com/gorhill/uMatrix
               | 
               | 6. https://github.com/gorhill/uBlock#ublock-origin
               | 
               | 7. https://github.com/mozilla/multi-account-
               | containers#readme
               | 
               | 8. https://decentraleyes.org/
               | 
               | 9. https://github.com/SimonBrazell/privacy-redirect
        
         | cuteboy19 wrote:
         | I am actually very thankful that the original wordle is a pwa
         | as well
        
       | otobrglez wrote:
       | I wrote this blog-post about cracking of the Wordle game. If you
       | are interested into its mechanics and implementation...
       | 
       | https://epic.blog/hacking/2022/01/26/cracking-the-wordle-gam...
        
       | Fnoord wrote:
       | There's a couple of other Rust versions of this game: wordle [1]
       | and wordlet [2]. Yours is lacking showing (qwerty) overview of
       | which letters were used. Although now that I think of it, its not
       | optimal to show it as qwerty for non-qwerty users.
       | 
       | [1] https://crates.io/crates/wordle
       | 
       | [2] https://crates.io/crates/wordlet
        
         | conradludgate wrote:
         | Yeah, I explicitly left out the keyboard view. It's technically
         | redundant information so I didn't want to deal with the extra
         | complexity
        
           | Fnoord wrote:
           | Redundant it is, yes, but I use it to determine which common
           | letter I have not yet used. Although dvorak or colemak are
           | more representative for such (because you can relate it to
           | the middle row) I have this legacy and defacto standard issue
           | with qwerty.
        
             | conradludgate wrote:
             | One thing I could do, also avoiding any specific keyboard
             | layout, is to render a 5x5 letter grid with these colours,
             | and give a shuffle ability. It being QWERTY or any other
             | keyboard layout does not offer any advantage over a random
             | layout
        
               | Fnoord wrote:
               | Yep, or abc, or vowels first, then consonants, or
               | different layouts and let user decide, with sane default.
        
         | jwandborg wrote:
         | The original wordle draws its own keyboard, which shows as
         | qwerty regardless.
        
       | satysin wrote:
       | I know it's totally pointless but it would have been cute if the
       | word in the demo gif was cargo :D
       | 
       | When I saw the first letter was C I totally thought that was what
       | the author had done.
        
         | conradludgate wrote:
         | Aww, I wish I had thought of that! I just went for the day 0
         | word, to try and avoid any trouble with spoilers
        
       | tasha0663 wrote:
       | > cl-wordle
       | 
       | Was _terdle_ already being used?
        
         | conradludgate wrote:
         | I default to publishing my crates under the prefix `cl-` (my
         | initials) if I don't intend them to be serious
        
           | davidkuhta wrote:
           | Totally thought that was cl for command line...
        
       | BlanketLogic wrote:
       | this looks neat. Thanks for sharing.
       | 
       | I published one too[0] which is much clumsier - it needs to be
       | interacted via wordlers. Of course mine is more for trying out an
       | algorithm or two for solving. But it also allows one to play cows
       | and bulls[1].
       | 
       | [0] https://crates.io/crates/wordlers [1]
       | https://en.wikipedia.org/wiki/Bulls_and_Cows
        
       | conradludgate wrote:
       | This was a quick project I put together this Sunday. I've been
       | needing a project that I can "finish" as I've been a bit
       | ambitious with my other projects recently.
       | 
       | It's probably not flawless and doesn't have any
       | leaderboard/statistics saving yes, but it does the job.
       | 
       | It uses the official word list and order, so every day should
       | match the website. It prints the emoji share upon finish too, so
       | you can share as you would normally
        
         | maxbond wrote:
         | Congrats on shipping your project!
         | 
         | I know you cut out lots of features for simplicity, which makes
         | total sense to me if your goal was to finish & ship it, but if
         | you wanted to add the wordle keyboard &c, you might look into
         | using `tui`.
        
         | throwthere wrote:
         | Mad respect for not mentioning Rust in the title.
        
           | petee wrote:
           | I appreciate your sentiment, although I do like to see the
           | language, personally, if it's something I need to compile -
           | not everyone has x-toolchain.
           | 
           | That said, being not unfamiliar with Rust, i did indeed
           | notice crates.io :)
        
           | conradludgate wrote:
           | I figured everyone who knew and cared enough about rust would
           | recognise the "crates.io" url ;)
        
       | jug wrote:
       | Awaiting a server listening to Telnet now, like the classic at
       | blinkenlights.nl
        
         | thefreeman wrote:
         | try out `ssh sshwordle.daveroda.com`
        
       ___________________________________________________________________
       (page generated 2022-02-06 23:00 UTC)