diff options
-rw-r--r-- | DONATORS | 6 | ||||
-rw-r--r-- | super_donators/grencez_tok5.c | 41 | ||||
-rwxr-xr-x | super_donators/sir@cmpwn.com | 21 |
3 files changed, 68 insertions, 0 deletions
diff --git a/DONATORS b/DONATORS new file mode 100644 index 00000000..fc7ee419 --- /dev/null +++ b/DONATORS | |||
@@ -0,0 +1,6 @@ | |||
1 | Minnesota > Florida | ||
2 | vdo <vdo@greyfaze.net> | ||
3 | Spitfire is best technicolor horse. | ||
4 | if bad people don't hate you, you're doing something wrong | ||
5 | Pinkie Pie is best pony. | ||
6 | JRS was here | ||
diff --git a/super_donators/grencez_tok5.c b/super_donators/grencez_tok5.c new file mode 100644 index 00000000..5c5be83c --- /dev/null +++ b/super_donators/grencez_tok5.c | |||
@@ -0,0 +1,41 @@ | |||
1 | /* Though it may look bleak at times, | ||
2 | * this ring will stabilize to have one token, | ||
3 | * and Tox will be the one true chat protocol! | ||
4 | * -- Alex P. Klinkhamer (grencez) | ||
5 | */ | ||
6 | #include <unistd.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <stdio.h> | ||
9 | int main(int i, char** msg) | ||
10 | { | ||
11 | int j, fd[4], xpd, xid; | ||
12 | if (--i<1) return 1; | ||
13 | srand(getpid()); | ||
14 | pipe(fd); | ||
15 | while (xid=rand()%5, --i>0) { | ||
16 | pipe(&fd[2]); | ||
17 | j = (0==fork() ? 0 : 1); | ||
18 | close(fd[j]); | ||
19 | fd[j] = fd[j+2]; | ||
20 | close(fd[3-j]); | ||
21 | if (j==0) break; | ||
22 | } | ||
23 | #define SendSc() write(fd[1], &xid, sizeof(xid)) | ||
24 | #define RecvPd() read(fd[0], &xpd, sizeof(xpd)) | ||
25 | #define A(g,v) if (g) {xid=v; puts(msg[i+1]); fflush(stdout); SendSc();} | ||
26 | SendSc(); | ||
27 | while (RecvPd(), 1) { | ||
28 | sleep(1); | ||
29 | if (i==0) { | ||
30 | A( xpd==0 && xid==0 , 1 ); | ||
31 | A( xpd==1 && xid<=1 , 2 ); | ||
32 | A( xpd> 1 && xid> 1 , 0 ); | ||
33 | continue; | ||
34 | } | ||
35 | A( xpd==0 && xid> 1 , xid/4 ); | ||
36 | A( xpd==1 && xid!=1 , 1 ); | ||
37 | A( xpd==2 && xid<=1 , 2+xid ); | ||
38 | A( xpd>=3 && xid<=1 , 4 ); | ||
39 | } | ||
40 | return 0; | ||
41 | } | ||
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 | ||