Commit a78a059
Changed files (3)
src
src/gol.h
@@ -1,9 +1,9 @@
static const char ALIVE='x';
static const char DEAD=' ';
-static const int WIDTH=3;
-static const int HEIGHT=3;
-static const int NUMBER_OF_CELLS=WIDTH*HEIGHT;
+extern const int WIDTH;
+extern const int HEIGHT;
+extern const int NUMBER_OF_CELLS;
int living_neighbours_for(char* world, int index);
char* evolve(char* world);
src/gol_test.c
@@ -3,6 +3,9 @@
#include "gol.h"
int tests_run = 0;
+const int WIDTH = 3;
+const int HEIGHT = 3;
+const int NUMBER_OF_CELLS=WIDTH*HEIGHT;
static char* test_foo() {
int foo = 7;
src/main.c
@@ -4,6 +4,10 @@
#include <time.h>
#include "gol.h"
+const int WIDTH = 5;
+const int HEIGHT = 5;
+const int NUMBER_OF_CELLS=WIDTH*HEIGHT;
+
int random_life() {
return rand() % 2 == 0 ? ALIVE : DEAD;
}