mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Forgot to commit these.
This commit is contained in:
parent
73b2144edc
commit
516b6ab46c
6
DONATORS
Normal file
6
DONATORS
Normal file
|
@ -0,0 +1,6 @@
|
|||
Minnesota > Florida
|
||||
vdo <vdo@greyfaze.net>
|
||||
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
|
41
super_donators/grencez_tok5.c
Normal file
41
super_donators/grencez_tok5.c
Normal file
|
@ -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 <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
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;
|
||||
}
|
21
super_donators/sir@cmpwn.com
Executable file
21
super_donators/sir@cmpwn.com
Executable file
|
@ -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
|
Loading…
Reference in New Issue
Block a user