Eco Simulation  «Prev  Next»
Lesson 7 Design your own simulation
ObjectiveWrite a more robust ecological simulation program.

Design your own simulation

Now you have seen all the components for a very simple ecological simulation game. It is functional, but not very interesting, so it is up to you to design and code a more robust version.
Use the basic components you have examined in this module as your starting point and let your imagination run wild. Here are a few considerations to get you started:
  1. How do you want to distinguish between lifeforms when the world is displayed? For example, you might want to give each type of lifeform a display character. This could be something quite simple, such as displaying an F when a fox occupies a square, an R for rabbit, and a G for grass
  2. How often do you want to display the world? After each cycle? After a set of cycles?
  3. How do you want to handle starting and stopping the simulation?
  4. Do you want the simulation command-line driven, allowing users to determine the size of the world, the lifespan of the different lifeforms, and the number of cycles?
  5. What sort of behaviors do you want the lifeforms to exhibit? In this module, you have seen some very simple behaviors, but with some creativity you could add more complicated interactions such as mating and reproduction.
  6. Do you want to add other lifeforms? You could have a hierarchy of predators and prey with complex rules about who eats who. Perhaps you want several types of plants, some of which are edible and some which are poisonous to other lifeforms.

As you can see, the simulation could get very complicated. Before you begin writing code, come up with a set of specifications. This will keep you from biting off more than you can chew. After all, predators only kill what they need to eat.

Write Simulation - Exercise

Click the Exercise link below to write your version of the ecological simulation program.
Write Simulation - Exercise