Project: step 3
"Life cycles"


Disclaimer: the automatically generated English translation is provided only for convenience and it may contain wording flaws. The original French document must be taken as reference!


But: Simulate the complete life cycle of lizards and scorpions (food consumption, reproduction, predation, escape and death).

At the end of this step, all the functionalities needed to visualize population dynamics will be implemented.

Required concepts: classes, constructors/destructors, operator overloading, inheritance and polymorphism.


Mise en place

The provided archive contains a new version of the CMakeLists.txt allowing to compile the material of this part. It also contains:

For this step, you will work in the directory partie3/.

General description of classes to be produced

The animals we have programmed will, at this stage, take two more concrete forms: lizards and scorpions.

We will also introduce cacti that the lizards will feed on.

Moreover, the environment was previously seen as a collection of animals and targets. It is clear that the notion of a target must now evolve: a lizard is a target for a scorpion but not the other way around, for example.

It therefore seems wise to revise our conception a little so as to view the environment as a set of organic entities/living beings, OrganicEntity, some of which are targets for others (food, mating partner, etc.).

Some of these entities will be mobile (the animals) and others static (the cacti).

For mobile entities, it will be necessary to manage their encounters. If an entity crosses the path of another (collision), there may be predation or reproduction, for example. The Collider class, coded in the first part of the project, will be used to perform collision tests.

To allow plants to grow, some basic weather elements will be introduced (rainy episodes). Clouds will appear (class Cloud). A utility class CloudGenerator will allow them to be generated randomly.

Here, to summarize, is the essential architecture that you will need to achieve at the end of this step:

Modele

Let's proceed now to the beginning of coding. In your program, make sure to properly encapsulate your classes and especially not to give public access to your attributes. You will also systematically take care of destructors.

Modules to program

The shutters (modules) to be implemented to finalize this step are as follows:

Steps 1 and 2 constitute the essential part of the work and will allow you to build almost the entire architecture of your project.

Their descriptions are long because they contain many explanations/questions, but their implementation does not involve writing many lines of code or sophisticated algorithms. However, it becomes imperative to properly modularize your methods.

Before diving into coding, make sure you understand the developments that are suggested to you: don't code by following the instructions line by line but start by reading it entirely (for each part) and make small diagrams of your architecture by placing attributes and methods in the right places, for example.

At the end of this stage, the necessary features to simulate population dynamics will all be present (excluding statistical curves):

[Video: Predator/Prey Simulation]

Back to the main document