diff options
| author | Zach DeCook <zachdecook@librem.one> | 2022-04-27 23:38:09 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2022-04-27 23:38:09 -0400 |
| commit | 5c9e7124f968cc381843dba285d4081231a9325d (patch) | |
| tree | 971d9b009bb91c8701a8de87db2c4f1d8fa9f62a | |
| download | gurglesolver-5c9e7124f968cc381843dba285d4081231a9325d.tar.gz | |
whatToDo: Make script to give advice for gurgle players
| -rwxr-xr-x | whatToDo.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/whatToDo.sh b/whatToDo.sh new file mode 100755 index 0000000..2c3816c --- /dev/null +++ b/whatToDo.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +LIST="$(cat -)" +if test "$(echo "$LIST" | wc -l)" -lt 15; then + # Get the answer on your next guess + echo "$LIST" +else + # Letters you want to guess + LETTERS="$(echo "$LIST" | sed 's/\(.\)/\1\n/g' | sort | uniq -c | sort -n)" + echo "$LETTERS" + grep5="$(echo "$LETTERS" | tac | awk '(p){printf("| grep " $2); p--;} ($2 == ""){p=5;}')" + grep4="$(echo "$LETTERS" | tac | awk '(p){printf("| grep " $2); p--;} ($2 == ""){p=4;}')" + grep3="$(echo "$LETTERS" | tac | awk '(p){printf("| grep " $2); p--;} ($2 == ""){p=3;}')" + + g5="$(sh -c "grep ^.....$ \"$1\" $grep5")" + if sh -c "grep ^.....$ \"$1\" $grep5"; then + echo + elif sh -c "grep ^.....$ \"$1\" $grep4"; then + echo + elif sh -c "grep ^.....$ \"$1\" $grep3"; then + echo + fi +fi |
