diff options
-rw-r--r-- | src/cgol.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -25,11 +25,12 @@ #include <unistd.h> #include <curses.h> -void usage(const char *invocation); void init_curses(); void init_game(); void fini_game(); void fini_curses(); +void print_cell(int i, int j); +void usage(const char *invocation); static int width, height; static double seedprob; @@ -142,7 +143,7 @@ init_game() /* Print the grid. */ for (i = 0; i < height; ++i) { for (j = 0; j < width; ++j) { - mvprintw(1 + i, 1 + j * 2, "%c", grid_cur[i * width + j] ? 'o' : ' '); + print_cell(i, j); } } } @@ -161,6 +162,12 @@ fini_curses() } void +print_cell(int i, int j) +{ + mvprintw(1 + i, 1 + j * 2, "%c", grid_cur[i * width + j] ? 'o' : ' '); +} + +void usage(const char *invocation) { printf("Usage: %s [-w WIDTH] [-h HEIGHT] [-s SEEDPROB] [-r RATE] " |