summaryrefslogtreecommitdiff
path: root/share/hackvr/examples
diff options
context:
space:
mode:
Diffstat (limited to 'share/hackvr/examples')
-rw-r--r--share/hackvr/examples/tictactoe/board_orig1
-rwxr-xr-xshare/hackvr/examples/tictactoe/game.sh21
2 files changed, 13 insertions, 9 deletions
diff --git a/share/hackvr/examples/tictactoe/board_orig b/share/hackvr/examples/tictactoe/board_orig
index 2d8a0e5..bc97ee4 100644
--- a/share/hackvr/examples/tictactoe/board_orig
+++ b/share/hackvr/examples/tictactoe/board_orig
@@ -1,4 +1,5 @@
_reset addshape 2 3 -4 -4 4 -5 -4 4 -4 -5 4
+_exit addshape 2 3 4 -4 4 5 -4 4 4 -5 4
topleft addshape 2 4 -3 3 4 -1 3 4 -1 1 4 -3 1 4
topcenter addshape 2 4 -1 3 4 1 3 4 1 1 4 -1 1 4
diff --git a/share/hackvr/examples/tictactoe/game.sh b/share/hackvr/examples/tictactoe/game.sh
index 68df498..a1d1ef3 100755
--- a/share/hackvr/examples/tictactoe/game.sh
+++ b/share/hackvr/examples/tictactoe/game.sh
@@ -1,14 +1,17 @@
#!/usr/bin/env bash
turn=$( expr $RANDOM % 2)
-cat camera.pos board
+BOARDFILE=board_orig
+cat camera.pos $BOARDFILE
echo "go. player: $turn" >&2
grep --line-buffered action \
- | while read user derp group;do
- echo FUCK >&2
+ | tee /dev/stderr | while read user derp group;do
+# echo FUCK >&2
if grep "_reset" <<<$group >/dev/null;then
printf "%s deleteallexcept .\n" "$user"
- cat board
+ cat $BOARDFILE
continue
+ elif grep "_exit" <<<$group >/dev/null;then #this doesn't work in local games. :/
+ exit 0
elif grep "_" <<<$group >/dev/null;then
# xmessage "CUT IT OUT"
echo CUT IT OUT > /dev/stderr
@@ -19,12 +22,12 @@ grep --line-buffered action \
printf "$user deletegroup %s\n" "$group"
#printf "$user deletegroup %s\n" "$group" > /dev/stderr
#need to get the first point of the group clicked and translate the new shape by that much
- translatex="$(grep "$group" board | grep -v '^#' | tr -s ' ' | cut '-d ' -f5)"
- translatey="$(grep "$group" board | grep -v '^#' | tr -s ' ' | cut '-d ' -f6)"
- cat "marker$turn"
- printf "%s move %s %s 2\n" "_marker" "$(expr "$translatex")" "$(expr "$translatey" - 2 )"
+ translatex="$(grep "$group" $BOARDFILE | grep -v '^#' | tr -s ' ' | cut '-d ' -f5)"
+ translatey="$(grep "$group" $BOARDFILE | grep -v '^#' | tr -s ' ' | cut '-d ' -f6)"
+ cat "marker$turn" | offsetshape.sh $translatex "$(expr "$translatey" - 2 )" 0
+# printf "%s move %s %s 2\n" "_marker" "$(expr "$translatex")" "$(expr "$translatey" - 2 )"
#printf "%s move %s %s 2\n" "_marker" "$(expr "$translatex")" "$(expr "$translatey" - 2 )" >/dev/stderr
- grep "$group" board | sed "s/$group/_marker2/g" #this is to make it still show the square around it.
+ grep "$group" $BOARDFILE | sed "s/$group/_marker2/g" #this is to make it still show the square around it.
printf "%s renamegroup _marker _marker%s%s\n" "$user" "$(date +%s)" "$RANDOM"
fi
done