Created
February 7, 2026 21:35
-
-
Save scruss/4b14fb589a9e913c7189a9a807955c8f to your computer and use it in GitHub Desktop.
terrible solver for Three Letters Game — https://threelettersgame.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # terrible solver for Three Letters Game — https://threelettersgame.com/ | |
| # scruss, 2026-02 | |
| # https://xoxo.zone/@scruss/116031000239771734 | |
| dict="/usr/share/dict/words" | |
| # usage | |
| if | |
| [ "$#" -lt 3 ] | |
| then | |
| echo usage: "$0" first second third [dictionary_file] | |
| exit 1 | |
| fi | |
| # last arg is optional dictionary file | |
| if | |
| [ "$#" -gt 3 ] | |
| then | |
| dict="$4" | |
| fi | |
| # dict file must exist | |
| if | |
| [ ! -f "$dict" ] | |
| then | |
| echo $0 error: "$dict" file must exist | |
| exit 1 | |
| fi | |
| # process three args to lower case and initial letter | |
| # yes, zsh would be better for this | |
| fl=${1,,} | |
| sl=${2,,} | |
| tl=${3,,} | |
| first=${fl:0:1} | |
| second=${sl:0:1} | |
| third=${tl:0:1} | |
| # for B, D & R, construct '^b[^r]*d.*r' | |
| regex="^${first}[^${third}]*${second}.*${third}" | |
| grep -P '^[abcdefghijklmnopqrstuvwxyz]{3,15}$' "$dict" |\ | |
| grep "$regex" |\ | |
| while read -r w | |
| do | |
| score=$(echo "$w" |\ | |
| tr 'abcdefghijklmnopqrstuvwxyz' \ | |
| '1332142418513113:11114484:' |\ | |
| sed 's/./ &/g;s/^ *//;s/:/10/g;s/ /+/g;' | bc) | |
| echo "$score" "$w" | |
| done |\ | |
| sort -nr |\ | |
| head -20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment