diff options
Diffstat (limited to 'tictactoe')
-rw-r--r-- | tictactoe/board | 11 | ||||
-rw-r--r-- | tictactoe/marker0 | 2 | ||||
-rw-r--r-- | tictactoe/marker1 | 1 | ||||
-rwxr-xr-x | tictactoe/run | 22 |
4 files changed, 36 insertions, 0 deletions
diff --git a/tictactoe/board b/tictactoe/board new file mode 100644 index 0000000..88f20fb --- /dev/null +++ b/tictactoe/board @@ -0,0 +1,11 @@ +topleft addshape 4 0 -3 3 0 -1 3 0 -1 1 0 -3 1 +topcenter addshape 4 0 -1 3 0 1 3 0 1 1 0 -1 1 +topright addshape 4 0 1 3 0 3 3 0 3 1 0 1 1 + +middleleft addshape 4 0 -3 1 0 -1 1 0 -1 -1 0 -3 -1 +middlecenter addshape 4 0 -1 1 0 1 1 0 1 -1 0 -1 -1 +middleright addshape 4 0 1 1 0 3 1 0 3 -1 0 1 -1 + +bottomleft addshape 4 0 -3 -1 0 -1 -1 0 -1 -3 0 -3 -3 +bottomcenter addshape 4 0 -1 -1 0 1 -1 0 1 -3 0 -1 -3 +bottomright addshape 4 0 1 -1 0 3 -1 0 3 -3 0 1 -3 diff --git a/tictactoe/marker0 b/tictactoe/marker0 new file mode 100644 index 0000000..613fbb4 --- /dev/null +++ b/tictactoe/marker0 @@ -0,0 +1,2 @@ +_marker addshape 2 0 .5 .5 0 1.5 1.5 +_marker addshape 2 0 1.5 .5 0 .5 1.5 diff --git a/tictactoe/marker1 b/tictactoe/marker1 new file mode 100644 index 0000000..61a3a22 --- /dev/null +++ b/tictactoe/marker1 @@ -0,0 +1 @@ +_marker addshape 4 0 1.5 1.5 0 .5 1.5 0 .5 .5 0 1.5 .5 diff --git a/tictactoe/run b/tictactoe/run new file mode 100755 index 0000000..4e06a75 --- /dev/null +++ b/tictactoe/run @@ -0,0 +1,22 @@ +#!/bin/bash +turn=$( expr $RANDOM % 2) +echo "go. player: $turn" +stdbuf -oL cat <(echo "$USER" move 0 -5 0) board p | ../src/hackvr_x11 "$USER" 2>/dev/null \ + | stdbuf -oL uniq \ + | grep --line-buffered clicked \ + | stdbuf -oL cut '-d ' -f5 | while read group;do + if grep "_" <<<$group >/dev/null;then +# xmessage "CUT IT OUT" + echo CUT IT OUT > /dev/stderr + else + turn=$(expr \( $turn + 1 \) % 2) + printf "# turn: %d\n" "$turn" > /dev/stderr + printf "$USER deletegroup %s\n" "$group" +#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 0 %s %s\n" "_marker" "$(expr "$translatex")" "$(expr -1 \* "$translatey" + 2)" + printf "%s renamegroup _marker _marker%s%s\n" "$USER" "$(date +%s)" "$RANDOM" + fi + done > p |