fix score
[multypo.git] / play.sh
diff --git a/play.sh b/play.sh
index 7b22b59c4786dc546cb6d313e42156d0268e5eaa..b427eeed67fc92378f8721f178ee342dbe533efd 100755 (executable)
--- a/play.sh
+++ b/play.sh
@@ -1,4 +1,19 @@
-#!/bin/sh
+#!/bin/bash
 
 
-cat words.txt | ./game
+# you should probably download a txt dictionary of your favourite language and use that as a words.txt
+
+cd "$(readlink -e $(dirname "$0"))"
+
+WORDSTOPLAY=10
+WORDSFILE="$1"
+if [[ -z "$WORDSFILE" ]]; then
+       WORDSFILE="words.txt"
+fi
+
+export LC_ALL=C # dont do unicode stuff in egrep
+while true; do
+  sort -R "$WORDSFILE" | sed 's/\/.*//' | egrep '^[A-Za-z]{5,}$' | head -n "$WORDSTOPLAY" | tr [:upper:] [:lower:] | qt/multypo
+  echo "Press Ctrl-C to quit"
+  sleep 3
+done