[Gllug] Hacker Attack, and a wild aside about version-controlled filesystems

ccooke ccooke-gllug at gkhs.net
Sat Jan 28 13:50:51 UTC 2006


On Sat, Jan 28, 2006 at 01:23:19PM +0000, Tethys wrote:
> 
> ccooke writes:
> 
> >> Interesting... it fills the screen semi-randomly, taking into
> >> account the contents of the 8 neighbouring character cells. A
> >
> >It's Conway's Game of Life
> 
> I did wonder about that, particularly with the checks for z being 2 or 3,
> but you never kill off cells due to overcrowding...
> 

It does, though. 

Okay, c is the value of the cell we care about. c defaults to ' ' (so, an
empty cell). q contains the state of c last tick. z is the total number of
occupied cells around c. If z is 2, then c becomes 1 (birth). If z is 3, c
is reset to q (so, if it was occupied, it remain occupied. Otherwise, it
remains empty. For any other value of z, c becomes empty (since nothing
stops it from being the default of ' ').

Essentially, although there are several *rules* making up the Game of
Life, they only have one of three effects. 

-- 
echo -ne "\E#8";b=$[X=`tput cols`,Y=`tput lines`,d=1,a=X/2,Y/2];while case $d\
 in 0)((a=a<2?X:a-1));;1)((b=b<2?Y:b-1));;2)((a=a==X?1:a+1));;3)((b=b==Y?1:b+\
1));; esac;do((c=b+a*X));v=${k[c]:- };[ $v. = @. ]&&{((d=d>2?0:d+1));k[c]="";\
}||{(( d=d<1?3:d-1));k[c]=@;};echo -ne "\E[$b;${a}H$v";done # Charles Cooke
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list