You know this wordle thing everyone is talking about, that was bought for millions? It has been implemented in 50 lines of bash. It works with just these commands:
The "clever" bit, ie. the bit that gives you the colour coded hints about which letters are right, is this few lines:
However I think there are some hard words on my system:
Code:
$ wget https://gist.githubusercontent.com/huytd/6a1a6a7b34a0d0abcac00b47e3d01513/raw/ca41929c10a6c2ed8faa77c298bb188abfe5145a/wordle.sh
$ bash wordle.sh
Code:
for ((i = 0; i < ${#actual}; i++)); do
if [[ "${actual:$i:1}" != "${guess:$i:1}" ]]; then
if [[ "$remaining" == *"${guess:$i:1}"* ]]; then
output+="\033[30;103m ${guess:$i:1} \033[0m"
remaining=${remaining/"${guess:$i:1}"/}
else
output+="\033[30;107m ${guess:$i:1} \033[0m"
fi
else
output+="\033[30;102m ${guess:$i:1} \033[0m"
fi
done
printf "$output\n"
Code:
$ grep '^\w\w\w\w\w$' /usr/share/dict/words | head
aahed
aalii
Aalst
Aalto
AAMSI
AAPSS
Aarau
Aaren
aargh
Aaron
Last edited: