summaryrefslogtreecommitdiffstats
path: root/cholerab/max_dirty_hack.sh
diff options
context:
space:
mode:
authorLassulus <Lassulus@googlemail.com>2011-07-22 14:47:53 +0200
committerLassulus <Lassulus@googlemail.com>2011-07-22 14:47:53 +0200
commit10bec08d281dfaf2f08f194790944525e7fbc5d5 (patch)
tree35e0cdef89d09d3cfb7823409679c91e67196b92 /cholerab/max_dirty_hack.sh
parent4b8ded8b9d183c13a2301cc0ed7dface0c650709 (diff)
multiplayer now through input/output files
Diffstat (limited to 'cholerab/max_dirty_hack.sh')
-rwxr-xr-xcholerab/max_dirty_hack.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/cholerab/max_dirty_hack.sh b/cholerab/max_dirty_hack.sh
index e8928d38..7fbd801b 100755
--- a/cholerab/max_dirty_hack.sh
+++ b/cholerab/max_dirty_hack.sh
@@ -6,6 +6,8 @@ x_cur=1
y_cur=1
y=
t=1
+outputfile=/tmp/cholerab_out
+inputfile=/tmp/cholerab_in
echo -n "c"
while [ $t -lt $(( y_max+2 )) ];do
@@ -77,20 +79,22 @@ while x="`dd bs=1 count=1 2>/dev/null`"; do
:
;;
(*)
- if [[ $x_cur -gt $x_max ]];then
- x_cur=1
- echo -n "[$y_cur;${x_cur}H"
- elif [[ $x_cur -eq $x_max ]];then
- echo -n "$x"
+ if [[ $x_cur -ge $x_max ]];then
x_cur=1
echo -n "[$y_cur;${x_cur}H"
else
echo -n "$x"
+ echo "<0 $x $x_cur $y_cur>" >> $tmpfile
x_cur=$(( x_cur+1 ))
fi
y=
;;
esac
+ while [[ -s $inputfile ]]; do
+ cat $inputfile | head -n 1 | sed 's,[<>],,g' | { read MODE CHAR XN YN ; echo -n "7[$YN;${XN}H$CHAR8"; }
+ sed -i -e "1d" $inputfile
+ done
+
state=`echo -n "$x" | od -An -tx | tr -d "[$IFS]"`
echo -n "7[1;$(( x_max+2 ))H$state8"
echo -n "7[2;$(( x_max+2 ))H 8"