summaryrefslogtreecommitdiff
path: root/examples/chess
diff options
context:
space:
mode:
Diffstat (limited to 'examples/chess')
-rwxr-xr-xexamples/chess/board.sh40
-rw-r--r--examples/chess/camera.pos2
-rwxr-xr-xexamples/chess/gnuchess-to-hackvr.sh31
-rwxr-xr-xexamples/chess/hackvr-to-gnuchess.sh18
-rw-r--r--examples/chess/pieces/bishop2
-rw-r--r--examples/chess/pieces/king2
-rw-r--r--examples/chess/pieces/knight2
-rw-r--r--examples/chess/pieces/pawn1
-rw-r--r--examples/chess/pieces/queen1
-rw-r--r--examples/chess/pieces/rook1
-rwxr-xr-xexamples/chess/run4
11 files changed, 0 insertions, 104 deletions
diff --git a/examples/chess/board.sh b/examples/chess/board.sh
deleted file mode 100755
index f574065..0000000
--- a/examples/chess/board.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-width=8
-height=8
-cols="a b c d e f g h"
-
-for x in $(seq 1 $width);do
- for y in $(seq 1 $height);do
- color=$[((($y % 2) + ($x % 2))%2)+16]
-### board is on the wall. draw in x and y.
-# printf "%s%s addshape %s 4 %s %s 0 %s %s 0 %s %s 0 %s %s 0\n" $(printf "%s\n" "$cols" | cut '-d ' -f$x) $y $color $x $y $[x+1] $y $[x+1] $[y+1] $x $[y+1]
-### board is on floor. draw in x and z.
- printf "%s%s addshape %s 4 %s 0 %s %s 0 %s %s 0 %s %s 0 %s\n" $(printf "%s\n" "$cols" | cut '-d ' -f$x) $y $color $x $y $[x+1] $y $[x+1] $[y+1] $x $[y+1]
- done
-done
-
-row8="rook knight bishop queen king bishop knight rook"
-row1="$row8"
-
-color="19 19 0 0 0 0 20 20"
-
-#draw pawns. triangles.
-for x in $(seq $width);do
- for y in 2 7;do
- locat="$(printf "%s\n" "$cols" | cut '-d ' "-f$x")$y"
- cat "./pieces/pawn" | sed 's/^[^ ][^ ]* addshape [0-9][0-9]* /piece_'"${locat}"' addshape '"$(printf "%s\n" "$color" | cut '-d ' "-f$y")"' /g'
-### board is on wall. use x and y.
-# printf "piece_%s move %s %s 0\n" "$locat" "$x" "$y"
-### board is on floor. use x and z.
- printf "piece_%s move %s 0 %s\n" "$locat" "$x" "$y"
- done
- for y in 1 8;do
- locat="$(printf "%s\n" "$cols" | cut '-d ' "-f$x")$y"
- cat "./pieces/$(printf "%s\n" "$row1" | cut '-d ' "-f$x")" | sed 's/^[^ ][^ ]* addshape [0-9][0-9]* /piece_'"${locat}"' addshape '"$(printf "%s\n" "$color" | cut '-d ' "-f$y")"' /g'
-### board is on wall. use x and y.
-# printf "piece_%s move %s %s 0\n" "$locat" "$x" "$y"
-### board is on floor. use x and z.
- printf "piece_%s move %s 0 %s\n" "$locat" "$x" "$y"
- done
-done
diff --git a/examples/chess/camera.pos b/examples/chess/camera.pos
deleted file mode 100644
index 32433c2..0000000
--- a/examples/chess/camera.pos
+++ /dev/null
@@ -1,2 +0,0 @@
-epoch move 5 5 -6
-derp set global.zoom 60
diff --git a/examples/chess/gnuchess-to-hackvr.sh b/examples/chess/gnuchess-to-hackvr.sh
deleted file mode 100755
index 0b94a87..0000000
--- a/examples/chess/gnuchess-to-hackvr.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-tee /dev/stderr | while read first second third;do
- if [ "_$first" = "_feature" ];then
- printf "# just gnuchess saying what features it has: %s %s %s\n" "$first" "$second" "$third" >&2
- elif printf "%s\n" "$first" | grep '^[0-9][0-9]*\.$' >/dev/null 2>&1;then
- #we made a successful move.
- ### how to tell hackvr to move the piece now? $second should contain what the move was.
- printf "# Hey! Hackvr! do this move: %s\n" "$second" >&2
- if [ "_$second" = "_..." ];then #computer/other person made a move.
- move=$third
- else
- move=$second
- fi
- from=$(printf "%s\n" "$move" | fold -w1 | head -n2 | tr -d '\n')
- to=$(printf "%s\n" "$move" | fold -w1 | tail -n+3 | head -n2 | tr -d '\n')
- x=$(echo "a b c d e f g h" | tr ' ' '\n' | grep -n "$(printf "%s\n" "$to" | fold -w1 | head -n1)" | cut -d: -f1)
- y=$(printf "%s\n" "$to" | fold -w1 | tail -n1)
- magic=$(printf "%s\n" "$move" | fold -w1 | tail -n+5 | tr -d '\n')
-### if the board is on the wall we need to use x and y
-# printf "piece_%s move %s %s 0\n" "$from" "$x" "$y" | tee /dev/stderr
-### the board is on the floor atm. use x and z
- printf "piece_%s move %s 0 %s\n" "$from" "$x" "$y" | tee /dev/stderr
-
- printf "#delete the old piece_%s group\n"
- printf "epoch deletegroup piece_%s\n" "$to"
- printf "epoch renamegroup piece_%s piece_%s\n" "$from" "$to" | tee /dev/stderr
- else
- #something else.
- printf "oops. something else happened. let's see: %s %s %s\n" "$first" "$second" "$third" >&2
- fi
-done
diff --git a/examples/chess/hackvr-to-gnuchess.sh b/examples/chess/hackvr-to-gnuchess.sh
deleted file mode 100755
index 94cd1ab..0000000
--- a/examples/chess/hackvr-to-gnuchess.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-part1=""
-echo "sleeping 3 seconds. might have gnuchess less likely to not do anything." >&2
-sleep 3
-echo "protover 2"
-while read derp command target extra;do
- if [ "_$command" = "_action" ];then
- if printf "%s\n" "$target" | grep -v "^piece_" 2>&1 > /dev/null;then #we are ignoring clicks on pieces in favor of squares atm. when full 3d probably want pieces.
- if [ "_$part1" = "_" ];then
- part1=$target
- else
- #we have two parts. let's tell gnuchess!
- printf "%s%s\n" $part1 $target
- part1=""
- fi
- fi
- fi
-done
diff --git a/examples/chess/pieces/bishop b/examples/chess/pieces/bishop
deleted file mode 100644
index db6f144..0000000
--- a/examples/chess/pieces/bishop
+++ /dev/null
@@ -1,2 +0,0 @@
-rook addshape 4 4 .4 .1 0 .6 .1 0 .6 .9 0 .4 .9 0
-rook addshape 4 4 .3 .6 0 .7 .6 0 .7 .8 0 .3 .8 0
diff --git a/examples/chess/pieces/king b/examples/chess/pieces/king
deleted file mode 100644
index 8ca79ef..0000000
--- a/examples/chess/pieces/king
+++ /dev/null
@@ -1,2 +0,0 @@
-king addshape 4 4 .1 .7 0 .3 .9 0 .9 .3 0 .7 .1 0
-king addshape 4 4 .3 .1 0 .9 .7 0 .7 .9 0 .1 .3 0
diff --git a/examples/chess/pieces/knight b/examples/chess/pieces/knight
deleted file mode 100644
index adc7f53..0000000
--- a/examples/chess/pieces/knight
+++ /dev/null
@@ -1,2 +0,0 @@
-knight addshape 4 4 .1 .1 0 .3 .1 0 .3 .9 0 .1 .9 0
-knight addshape 4 4 .1 .1 0 .9 .1 0 .9 .3 0 .1 .3 0
diff --git a/examples/chess/pieces/pawn b/examples/chess/pieces/pawn
deleted file mode 100644
index d7d2d29..0000000
--- a/examples/chess/pieces/pawn
+++ /dev/null
@@ -1 +0,0 @@
-pawn addshape 4 3 .2 .1 0 .8 .1 0 .5 .5 0
diff --git a/examples/chess/pieces/queen b/examples/chess/pieces/queen
deleted file mode 100644
index 3ebb4ab..0000000
--- a/examples/chess/pieces/queen
+++ /dev/null
@@ -1 +0,0 @@
-pawn addshape 4 3 .2 .1 0 .8 .1 0 .5 .9 0
diff --git a/examples/chess/pieces/rook b/examples/chess/pieces/rook
deleted file mode 100644
index 2550eb5..0000000
--- a/examples/chess/pieces/rook
+++ /dev/null
@@ -1 +0,0 @@
-rook addshape 4 4 .4 .1 0 .6 .1 0 .6 .9 0 .4 .9 0
diff --git a/examples/chess/run b/examples/chess/run
deleted file mode 100755
index 4f0cdce..0000000
--- a/examples/chess/run
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-mknod p p
-stdbuf -oL cat camera.pos <(./board.sh) <(cat p | ./gnuchess-to-hackvr.sh) | hackvr "$USER" | ./hackvr-to-gnuchess.sh | gnuchess -x > p
-rm p