Esempio n. 1
0
int main(void)
{
  initscr();
  noecho();
  noecho();
  curs_set(0); 

  int grid[COLS][LINES];

  init_life (grid);
  printgrid (grid);
  
  for (;;)
    {
      run_life (grid);
      printgrid (grid);
      refresh();
      if (gameover(grid) == 0)
	break;
      usleep (50000);
    }

  refresh();
  endwin();
  return 0;
}
Esempio n. 2
0
/*
  Pointless Idea, it'd be cool to run a '###' across the grid, in such a way
  that it moved one block at a time, or something.
*/
int main(int argc, char **argv){
  srandom(time(NULL));
  //add options later
  ncurses_init();
  atexit((void(*)(void))endwin);
  sigaction(SIGTERM, &interupt_act, NULL);
  world *w = init_world(term_rows, term_cols);
  randomize_grid(w);
  draw_world(w, stdscr);
  while(1){
    wmove(stdscr, 0, 0);
    setup_initial_conditons(w, stdscr);
    run_life(w, stdscr);
  }
}