summaryrefslogtreecommitdiff
path: root/tictactoe
diff options
context:
space:
mode:
Diffstat (limited to 'tictactoe')
-rwxr-xr-xtictactoe/listen.sh16
-rwxr-xr-xtictactoe/run2
2 files changed, 15 insertions, 3 deletions
diff --git a/tictactoe/listen.sh b/tictactoe/listen.sh
index 4379a3d..0318cd2 100755
--- a/tictactoe/listen.sh
+++ b/tictactoe/listen.sh
@@ -3,7 +3,17 @@
#mabe not. might be buggier.
#cat board p1out | ncat -lp 1050 > p1in &
#cat board p2out | ncat -lp 1051 > p2in &
-cat board p1out | ncat -lp 1050 > p1in &
-cat board p2out | ncat -lp 1051 > p1in &
+echo listening in port 1050 for player 1 and 1051 for player 2
-cat p1in | ./game.sh | tee p1out p2out
+mknod pin p
+mknod p1out p
+mknod p2out p
+
+cat board p1out | ncat -lp 1050 > pin &
+cat board p2out | ncat -lp 1051 > pin &
+
+cat pin | ./game.sh | tee p1out p2out
+
+rm pin
+rm p1out
+rm p2out
diff --git a/tictactoe/run b/tictactoe/run
index c38c9cc..f470780 100755
--- a/tictactoe/run
+++ b/tictactoe/run
@@ -1,4 +1,6 @@
#!/bin/bash
turn=$( expr $RANDOM % 2)
echo "go. player: $turn"
+mknod p p
stdbuf -oL cat board p | ../src/hackvr_x11 "$USER" | ./game.sh > p
+rm p