From 516b6ab46c6735db673ea68f4f117c0d53d755f1 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 26 Nov 2015 10:44:16 -0500 Subject: Forgot to commit these. --- DONATORS | 6 ++++++ super_donators/grencez_tok5.c | 41 +++++++++++++++++++++++++++++++++++++++++ super_donators/sir@cmpwn.com | 21 +++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 DONATORS create mode 100644 super_donators/grencez_tok5.c create mode 100755 super_donators/sir@cmpwn.com diff --git a/DONATORS b/DONATORS new file mode 100644 index 00000000..fc7ee419 --- /dev/null +++ b/DONATORS @@ -0,0 +1,6 @@ +Minnesota > Florida +vdo +Spitfire is best technicolor horse. +if bad people don't hate you, you're doing something wrong +Pinkie Pie is best pony. +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 @@ +/* Though it may look bleak at times, + * this ring will stabilize to have one token, + * and Tox will be the one true chat protocol! + * -- Alex P. Klinkhamer (grencez) + */ +#include +#include +#include +int main(int i, char** msg) +{ + int j, fd[4], xpd, xid; + if (--i<1) return 1; + srand(getpid()); + pipe(fd); + while (xid=rand()%5, --i>0) { + pipe(&fd[2]); + j = (0==fork() ? 0 : 1); + close(fd[j]); + fd[j] = fd[j+2]; + close(fd[3-j]); + if (j==0) break; + } +#define SendSc() write(fd[1], &xid, sizeof(xid)) +#define RecvPd() read(fd[0], &xpd, sizeof(xpd)) +#define A(g,v) if (g) {xid=v; puts(msg[i+1]); fflush(stdout); SendSc();} + SendSc(); + while (RecvPd(), 1) { + sleep(1); + if (i==0) { + A( xpd==0 && xid==0 , 1 ); + A( xpd==1 && xid<=1 , 2 ); + A( xpd> 1 && xid> 1 , 0 ); + continue; + } + A( xpd==0 && xid> 1 , xid/4 ); + A( xpd==1 && xid!=1 , 1 ); + A( xpd==2 && xid<=1 , 2+xid ); + A( xpd>=3 && xid<=1 , 4 ); + } + return 0; +} 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 @@ +#!/bin/bash +# Run ./sir@cmpwn.com +# Arrow keys or wasd to move + +c=`tput cols`;L=`tput lines` +let x=$c/2;let y=$L/2;d=0;le=3;t="$y;$x";i=0;j=0;S=0 +A(){ let i=($RANDOM%$c);let j=($RANDOM%$L);};A +B(){ printf $*;};C(){ B "\x1B[$1";};D(){ C "$1H";} +F(){ D "0;0";C 2J;C "?25h";printf "GAME OVER\nSCORE: $S\n";exit;};trap F INT +C ?25l;C 2J;da(){ D "$j;$i";echo "$1";} +G() { for n in $t; do D "$n";echo "$1";done;} +mt(){ t=`echo "$t"|cut -d' ' -f2-`;} +sc(){ D "0;0";echo "Score: $S"; } +gt() { t+=" $y;$x";};ct() { for n in $t; do [ "$y;$x" == "$n" ]&&F;done;} +M() { case $d in 0)let y--;;1)let x--;;2)let y++;;3)let x++;;esac +let x%=$c;let y%=$L;ct;[ "$y$x" == "$j$i" ]&&{ let le++;A;let S++;} +l=`tr -dc ' '<<<"$t"|wc -c`;gt;[ $l -gt $le ]&&mt;} +ky() { k=$1;read -sN1 -t 0.01 k1;read -sN1 -t 0.01 k2;read -sN1 -t 0.01 k3 +k+=${k1}${k2}${k3};case $k in w|$'\e[A'|$'\e0A')d=0;;a|$'\e[D'|$'\e0D')d=1;; +s|$'\e[B'|$'\e0B')d=2;;d|$'\e[C'|$'\e0C')d=3;;esac;} +while :;do da ' ';G ' ';M;da "@";G "#";sc;read -s -n 1 -t 0.1 k && ky "$k";done -- cgit v1.2.3