Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- declare -A g t
- for((;i++<$3;x=RANDOM%$1,y=RANDOM%$2,g[$x,$y]=1)){ :;};printf \\e[2J
- for((;;)){ for((i=0;i<$1;i++)){ for((j=0;j<$2;j++)){((c=g[$i,$j]?-1:0))
- for((a=i-2;++a<i+2;)){ for((b=j-2;++b<j+2;g[$a,$b]&&c++)){ :;};}
- ((c==2))||((t[$i,$j]=c==3?1:0));((t[$i,$j]))&&p+=O||p+=.;};p+=\\n;}
- printf \\e[H$p;p=;for i in ${!t[@]};{ g[$i]=${t[$i]};};}
Add Comment
Please, Sign In to add comment