TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Wordle clone in 50 lines of Bash

271 pointsby huydotnetover 3 years ago

17 comments

kccqzyover 3 years ago
This doesn&#x27;t handle Yellow result correctly. Specifically, if there is a repeated letter in the guess but that letter appears once in the actual word, then the second occurrence will get a Black instead of a Yellow.<p>In other words, a Yellow result doesn&#x27;t just mean that letter occurs somewhere. A Black also doesn&#x27;t mean the letter occurs nowhere.
评论 #30175221 未加载
评论 #30176374 未加载
评论 #30174404 未加载
评论 #30175060 未加载
评论 #30175010 未加载
mkdirpover 3 years ago
Slightly off-topic - I&#x27;ve seen wordle become very popular out of nowhere, and haven&#x27;t been following it. I&#x27;m trying to understand how it would be played. Is this basically Lingo (a gameshow on Dutch TV) but for individuals and as an app?
评论 #30175302 未加载
评论 #30175869 未加载
评论 #30175752 未加载
评论 #30178566 未加载
评论 #30175257 未加载
sinabover 3 years ago
This is great, thank you for creating it! I just added it to my $PATH.
seanp2k2over 3 years ago
Doesn&#x27;t work for me on linux using 5.1.8(1)-release (x86_64-pc-linux-gnu). Output with `set -vx` at top (I guessed &quot;fooba&quot;):<p><pre><code> ++ [[ false != true ]] ++ guess_count=1 ++ [[ 1 -le 6 ]] ++ echo &#x27;Enter your guess (1 &#x2F; 6):&#x27; Enter your guess (1 &#x2F; 6): ++ read guess fooba +++ echo fooba +++ tr &#x27;[a-z]&#x27; &#x27;[A-Z]&#x27; ++ guess=FOOBA [... ÉTUDE =~ FOOBA ]] ++ echo &#x27;Please enter a valid word with 5 letters!&#x27; Please enter a valid word with 5 letters! ++ guess_count=0 ++ [[ false != true ]] ++ guess_count=1 ++ [[ 1 -le 6 ]] ++ echo &#x27;Enter your guess (1 &#x2F; 6):&#x27; Enter your guess (1 &#x2F; 6): ++ read guess</code></pre>
评论 #30174461 未加载
shmerlover 3 years ago
Really neat!<p>I wish bash would have a nicer way to address a character in a string though. How hard would it be to use the same syntax as for arrays for it?<p>By the way, this can be expressed simpler:<p><pre><code> guess_count=$(( $guess_count - 1 )) </code></pre> As<p><pre><code> ((guess_count--))</code></pre>
评论 #30174874 未加载
评论 #30174759 未加载
alana314over 3 years ago
This is awesome. My word was cleam though. That was hard.
评论 #30174695 未加载
评论 #30186702 未加载
surrTurrover 3 years ago
And here’s a quick one-liner to solve Wordle puzzles:<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;AlexWeichart&#x2F;status&#x2F;1488223629867462664" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;AlexWeichart&#x2F;status&#x2F;1488223629867462664</a>
评论 #30175637 未加载
indigodaddyover 3 years ago
Gotta be something wrong here no?<p><a href="https:&#x2F;&#x2F;ibb.co&#x2F;2dFhwN4" rel="nofollow">https:&#x2F;&#x2F;ibb.co&#x2F;2dFhwN4</a>
评论 #30174997 未加载
huydotnetover 3 years ago
Thank you so much everyone! The issue with the yellow letters is fixed. Please give it a try again!
climechover 3 years ago
Pro tip: if you&#x27;re using Solarized, change to another color scheme before running it.
0xeddover 3 years ago
Nice work!<p>With enough determination, anything can be a one liner in bash. &#x2F;joke
indigodaddyover 3 years ago
Sweet, I even got it to work on my iPhone with iSH terminal!
libeleover 3 years ago
finally the words file has a purpose again
tomcat27over 3 years ago
Million dollah 50 lines
aurahamover 3 years ago
Really cool!
aronhegedusover 3 years ago
very cool!
jsiaajdsdaaover 3 years ago
Someone needs to make the obligatory &quot;Wordle clone in 50,000 lines of react&#x2F;java&#x2F;nosql&#x2F;docker&#x2F;terraform&#x2F;documentation&#x2F;7GB of unused dependencies&quot; :)
评论 #30176343 未加载
评论 #30174896 未加载
评论 #30187194 未加载
评论 #30175017 未加载
评论 #30184017 未加载
评论 #30178575 未加载
评论 #30175216 未加载