summaryrefslogtreecommitdiff
path: root/examples/chess/hackvr-to-gnuchess.sh
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2018-03-31 22:20:15 -0500
committerepoch <epoch@hacking.allowed.org>2018-03-31 22:20:15 -0500
commit706561629ee22078fc8e976979f49da397920047 (patch)
treeb5114f51343d030058786723db2a31a8acdb668f /examples/chess/hackvr-to-gnuchess.sh
parent9e49dcb25e7ccea65948adb07be6206f867b79f5 (diff)
downloadhackvr-706561629ee22078fc8e976979f49da397920047.tar.gz
hackvr-706561629ee22078fc8e976979f49da397920047.zip
added example game of chess that uses gnuchess as backend
Diffstat (limited to 'examples/chess/hackvr-to-gnuchess.sh')
-rwxr-xr-xexamples/chess/hackvr-to-gnuchess.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/chess/hackvr-to-gnuchess.sh b/examples/chess/hackvr-to-gnuchess.sh
new file mode 100755
index 0000000..94cd1ab
--- /dev/null
+++ b/examples/chess/hackvr-to-gnuchess.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+part1=""
+echo "sleeping 3 seconds. might have gnuchess less likely to not do anything." >&2
+sleep 3
+echo "protover 2"
+while read derp command target extra;do
+ if [ "_$command" = "_action" ];then
+ if printf "%s\n" "$target" | grep -v "^piece_" 2>&1 > /dev/null;then #we are ignoring clicks on pieces in favor of squares atm. when full 3d probably want pieces.
+ if [ "_$part1" = "_" ];then
+ part1=$target
+ else
+ #we have two parts. let's tell gnuchess!
+ printf "%s%s\n" $part1 $target
+ part1=""
+ fi
+ fi
+ fi
+done