Faster generations

master
Micke Nordin 8 years ago
parent 4d642f3c6e
commit 3f4a1487c4

@ -95,14 +95,23 @@ int main(int argc, char* argv[] ) {
// Set up the initial condition // Set up the initial condition
int initial[DIM][DIM]; int initial[DIM][DIM];
int row = rand() % DIM;
int column = rand() % DIM;
for(int i = 0; i < DIM; i++) { for(int i = 0; i < DIM; i++) {
for(int j = 0; j < DIM; j++) { for(int j = 0; j < DIM; j++) {
if(i == HALF && j == HALF ) { if(i == DIM -1 && j == HALF ) {
initial[i][j] = 1; initial[i][j] = 1;
} else { } else {
initial[i][j] = 0; initial[i][j] = 0;
} }
//initial[i][j] = rand() % 1;
//initial[i][j] = rand() % 2;
/*if(i == column && j == row ) {
initial[i][j] = 1;
} else {
initial[i][j] = 0;
}*/
} }
} }
@ -115,8 +124,8 @@ int main(int argc, char* argv[] ) {
cout << "Rule: " << rule << " generation: " << i << endl; cout << "Rule: " << rule << " generation: " << i << endl;
// Print the current state // Print the current state
print_arr(initial); print_arr(initial);
// Sleep 0.5 seconds // Sleep 0.05 seconds
usleep(500000); usleep(50000);
// The next state // The next state
int next[DIM][DIM]; int next[DIM][DIM];

Loading…
Cancel
Save