#include #include #include //for strcmp #include "life.h" //for class life, life_xmax, and life_ymax using namespace std; int main() { const bool glider_matrix[life_ymax][life_xmax] = { //sorry y before x {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; for (life glider = glider_matrix;; glider.next()) { glider.print(); cout << glider.generation() << ": Press c to continue, q to quit, and RETURN.\n"; char buffer[256]; cin >> buffer; if (strcmp(buffer, "c") != 0) { break; } } return EXIT_SUCCESS; }