Eco Simulation  «Prev 

Initializing and Displaying the simulation

Objective: Write two functions for the main() function of the simulation--one to generate an initial world and one to display the world.

Instructions

Implement the eden() function to initialize the world when the simulation begins and the pr_state() function to display the world.
Here is main() again for your reference:
int main(){
world  odd, even;
int    i;
 
init(odd);  init(even);

//initialize inside world to non-empty types
eden(even);         //generate initial world
pr_state(even);      //display garden of eden state

for (i = 0; i < CYCLES; ++i) {  //simulation
   if (i % 2) {
	  update(even, odd);
	  pr_state(even);
	  dele(odd);
   }
   else {
	  update(odd, even);
	  pr_state(odd);
	  dele(even);
   }
}
return 0;
}

Paste your code below and click the Submit button when you are ready to submit this exercise.