1#include <stdio.h>
2#include <poll.h>
3#include "h.h"
4
5int
6main()
7{
8 int n,k,i;
9 for(;;poll(0,0,100),puts("\033[H")) {
10 for(i=w*h;i--;g[i]|=(n==3|n==g[i]+3)*2,i%w||putchar(10))
11 for(n=0,k=9,putchar(46-11*g[i]);k--;n+=g[((i/w+k/3+h-1)%h)*w+(i+k%3+w-1)%w]&1);
12 while(++i<h*w)g[i]/=2;
13 }
14}