diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-31 00:54:16 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-31 11:54:55 +1200 |
commit | 26d986c198a4795e927898088213144fb9f75c3f (patch) | |
tree | 8a58e41c47b0f8d5520abd8a6b4b0b706391de42 /games | |
parent | Add a shellcheck exception (diff) | |
download | dotfiles-26d986c198a4795e927898088213144fb9f75c3f.tar.gz dotfiles-26d986c198a4795e927898088213144fb9f75c3f.zip |
Remove poetry games tinkering scripts
Moving these into their own suite shortly
Diffstat (limited to 'games')
-rwxr-xr-x | games/hku | 17 | ||||
-rwxr-xr-x | games/syl | 71 | ||||
-rwxr-xr-x | games/wrdl | 10 | ||||
-rwxr-xr-x | games/wrds | 3 |
4 files changed, 0 insertions, 101 deletions
diff --git a/games/hku b/games/hku deleted file mode 100755 index 4deb7460..00000000 --- a/games/hku +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -hash syl || exit -declare -a lsts ws -lsts=(5 7 5) -for ((lc=0;lc<${#lsts[@]};lc++)) ; do - ws=() - for ((sc=0;sc<lsts[lc];)) ; do - read -r wr - sy=$(syl "$wr") - ((sy<=lsts[lc]-sc)) || continue - ws[${#ws[@]}]=$wr - ((sc+=sy)) - done - printf '%s\n' "${ws[*]}" -done < <(shuf "${@:-/usr/share/dict/words}" | - grep -v \'s\$) | - tr '[:upper:]' '[:lower:]' diff --git a/games/syl b/games/syl deleted file mode 100755 index d83187c6..00000000 --- a/games/syl +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -# Apply some dumb heuristics to guess at the number of syllables in the English -# word given as the sole required argument -word=${1:?Need a word} -lcword=$(printf %s "$word" | tr '[:upper:]' '[:lower:]') - -# Start counting syllables for the word and vowels for the current vowel group -declare -i sylc vowc - -# Iterate through the letters in the word -for ((i = 0; i < ${#word}; i++)); do - case ${word:i:1} in - - # If it's a vowel or a y, we might be adding a syllable. We here - # include all the vowels I got out of /usr/share/dict/words on my - # system. - [aeiouyáâäåèéêíóôöûü]) - - # Bump the number of vowels so far in this group - ((vowc++)) - - # On every odd vowel, we'll add another syllable, so that "e" and - # "ei" are each one syllable, but "eia" and "eiau" are two. - ((vowc % 2)) && ((sylc++)) - ;; - - # If it's not a vowel or a y, reset the vowel count - *) - ((vowc = 0)) - ;; - esac -done - -# As a special case, if the word ends with a consonant and then "e" and has -# more than one syllable, subtract one syllable as it's probably a silent "e" -if ((sylc > 1)) ; then - case $lcword in - - # Exceptions first - *[bcdgptx]le|*c[mn]e|*phe) - ;; - *[!aeiouy]e) - ((sylc--)) - ;; - - # "pined", "loved", but not "wasted", "devoted" - *[bcdgptx]led) - ;; - *[!aeiotuy]ed) - ((sylc--)) - ;; - - # Plural forms of the above - *[bc]les|*c[mn]es|*phes) - ;; - *[!aeiousy]es) - ((sylc--)) - ;; - esac -fi - -# Add a syllable for an "ism" suffix -case $lcword in - *ism|*isms) - ((sylc++)) - ;; -esac - -# Print the determined syllable count -printf '%u\n' "$sylc" diff --git a/games/wrdl b/games/wrdl deleted file mode 100755 index 2b482514..00000000 --- a/games/wrdl +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -cat -- "${@:-/dev/stdin}" | -while read -r -a ws ; do - for w in "${ws[@]}" ; do - w=${w%%[^a-zA-Z]*} - w=${w##*[^a-zA-Z]} - [[ $w ]] || continue - printf '%s\n' "$w" - done -done | tr '[:upper:]' '[:lower:]' diff --git a/games/wrds b/games/wrds deleted file mode 100755 index e56cc363..00000000 --- a/games/wrds +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -grep -v \''s$' /usr/share/dict/words | -shuf -n "${1:-10}" |