~lsof/x

71d9f34bdb96c652fa7a20d9d93b5bcb6e72f8a1 — lemon 2 years ago 1f4a15a
vla/life: be more careful with `gwip` ^^;
1 files changed, 7 insertions(+), 4 deletions(-)

M vla/life.c
M vla/life.c => vla/life.c +7 -4
@@ 32,9 32,12 @@

/* live cells = 0, dead cells = 1..255, depending how long they've been dead,
 * for a fadeout effect */
static unsigned char board[H][W], boardtmp[H][W]; char title[60]; static unsigned gen;
static SDL_Window *win; static SDL_Renderer *ren; static bool running = 1,
                  pause;
static unsigned char board[H][W], boardtmp[H][W];
static char title[60];
static unsigned gen;
static SDL_Window *win;
static SDL_Renderer *ren;
static bool running = 1, pause;

#define neighbours(b,y,x)                                            \
   ( !b[(y-1)%H][(x-1)%W] + !b[(y-1)%H][(x)%W] + !b[(y-1)%H][(x+1)%W]   \


@@ 51,7 54,7 @@ static void life(size_t i, size_t y, size_t x, size_t n, char _[(
   : (board[y][x] == 0) ?
      boardtmp[y][x] = 150
   :
      (boardtmp[i/W][i%W] = MIN(boardtmp[i/W][i%W]*5/4, 255)),
      (boardtmp[y][x] = MIN(boardtmp[y][x]*5/4, 255)),

   (++i < W*H) ?
      TAIL life(i, y,x,n,"")