diff options
author | irungentoo <irungentoo@gmail.com> | 2015-11-26 10:44:16 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-11-26 10:44:16 -0500 |
commit | 516b6ab46c6735db673ea68f4f117c0d53d755f1 (patch) | |
tree | b61bfa5b09019c9c4abba940fcbce62e140236cd /super_donators/sir@cmpwn.com | |
parent | 73b2144edcfd1ca617e9054479b66ab0c0361a14 (diff) |
Forgot to commit these.
Diffstat (limited to 'super_donators/sir@cmpwn.com')
-rwxr-xr-x | super_donators/sir@cmpwn.com | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/super_donators/sir@cmpwn.com b/super_donators/sir@cmpwn.com new file mode 100755 index 00000000..cfa989b0 --- /dev/null +++ b/super_donators/sir@cmpwn.com | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/bash | ||
2 | # Run ./sir@cmpwn.com | ||
3 | # Arrow keys or wasd to move | ||
4 | |||
5 | c=`tput cols`;L=`tput lines` | ||
6 | let x=$c/2;let y=$L/2;d=0;le=3;t="$y;$x";i=0;j=0;S=0 | ||
7 | A(){ let i=($RANDOM%$c);let j=($RANDOM%$L);};A | ||
8 | B(){ printf $*;};C(){ B "\x1B[$1";};D(){ C "$1H";} | ||
9 | F(){ D "0;0";C 2J;C "?25h";printf "GAME OVER\nSCORE: $S\n";exit;};trap F INT | ||
10 | C ?25l;C 2J;da(){ D "$j;$i";echo "$1";} | ||
11 | G() { for n in $t; do D "$n";echo "$1";done;} | ||
12 | mt(){ t=`echo "$t"|cut -d' ' -f2-`;} | ||
13 | sc(){ D "0;0";echo "Score: $S"; } | ||
14 | gt() { t+=" $y;$x";};ct() { for n in $t; do [ "$y;$x" == "$n" ]&&F;done;} | ||
15 | M() { case $d in 0)let y--;;1)let x--;;2)let y++;;3)let x++;;esac | ||
16 | let x%=$c;let y%=$L;ct;[ "$y$x" == "$j$i" ]&&{ let le++;A;let S++;} | ||
17 | l=`tr -dc ' '<<<"$t"|wc -c`;gt;[ $l -gt $le ]&&mt;} | ||
18 | ky() { k=$1;read -sN1 -t 0.01 k1;read -sN1 -t 0.01 k2;read -sN1 -t 0.01 k3 | ||
19 | k+=${k1}${k2}${k3};case $k in w|$'\e[A'|$'\e0A')d=0;;a|$'\e[D'|$'\e0D')d=1;; | ||
20 | s|$'\e[B'|$'\e0B')d=2;;d|$'\e[C'|$'\e0C')d=3;;esac;} | ||
21 | while :;do da ' ';G ' ';M;da "@";G "#";sc;read -s -n 1 -t 0.1 k && ky "$k";done | ||