master pita/gol / c / main.c
 1#include <stdio.h>
 2#include <sys/select.h> 
 3#include "h.h"
 4
 5int
 6main()
 7{
 8  int n,k,i,c;
 9  for(;;select(0,0,0,0,&(struct timeval){0,100000}),printf("\033[H")) {
10    for(i=w*h;i--;g[i]|=(n==3||(c&&n==4))<<1, i%w||putchar(10))
11      for(n=0,k=9,c=g[i]&1,putchar(46-11*c);k--;)
12	n += g[((i/w+k/3+h-1)%h)*w+(i+k%3+w-1)%w]&1;
13    for (i = w*h;i--;g[i]>>=1);
14  }
15  return 0;
16}