diff options
author | epoch <epoch@hacking.allowed.org> | 2017-09-30 02:42:07 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2017-09-30 02:42:07 -0500 |
commit | baa5faa2e60e698a2b44f27f14c3b32c3f4cc80c (patch) | |
tree | b459af4c6479ddf1761a29cf13a8d672bab90d99 /tictactoe/run | |
parent | 94c52214febfe1d4c51b4808e637d97de3d5a109 (diff) | |
download | hackvr-baa5faa2e60e698a2b44f27f14c3b32c3f4cc80c.tar.gz hackvr-baa5faa2e60e698a2b44f27f14c3b32c3f4cc80c.zip |
got rid of some hacks that were just there to get around hackvr being shit
Diffstat (limited to 'tictactoe/run')
-rwxr-xr-x | tictactoe/run | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tictactoe/run b/tictactoe/run index 4e06a75..d719f2e 100755 --- a/tictactoe/run +++ b/tictactoe/run @@ -1,7 +1,7 @@ #!/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 cat board p | ../src/hackvr_x11 "$USER" \ | stdbuf -oL uniq \ | grep --line-buffered clicked \ | stdbuf -oL cut '-d ' -f5 | while read group;do @@ -12,11 +12,13 @@ stdbuf -oL cat <(echo "$USER" move 0 -5 0) board p | ../src/hackvr_x11 "$USER" 2 turn=$(expr \( $turn + 1 \) % 2) printf "# turn: %d\n" "$turn" > /dev/stderr 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)" + translatex="$(grep "$group" board | grep -v '^#' | tr -s ' ' | cut '-d ' -f4)" + translatey="$(grep "$group" board | grep -v '^#' | tr -s ' ' | cut '-d ' -f5)" cat "marker$turn" - printf "%s move 0 %s %s\n" "_marker" "$(expr "$translatex")" "$(expr -1 \* "$translatey" + 2)" + printf "%s move %s %s 0\n" "_marker" "$(expr "$translatex")" "$(expr "$translatey" - 2 )" + printf "%s move %s %s 0\n" "_marker" "$(expr "$translatex")" "$(expr "$translatey" - 2 )" >/dev/stderr printf "%s renamegroup _marker _marker%s%s\n" "$USER" "$(date +%s)" "$RANDOM" fi done > p |