Project 2026
“Microbial Cultures”

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!

Goal

Through this project, you will learn how to create a complete program that is larger in scale than those you have worked with up to now. Your program will also include a graphical component. In terms of computer science, the goal of this project is to consolidate your programming knowledge and give you practice with the essential concepts of object-oriented programming: abstraction and encapsulation, inheritance, virtual methods, and polymorphism.

It is not recommended to print the entire project statement: additional information may be provided along the way.

Introduction | Tasks | References

Introduction

Every program must be designed before it is implemented. The purpose of this design phase is to establish a computer model of the program's components, which involves asking a number of questions: To answer these questions, it is obviously important to have a fairly clear idea of what you want to achieve. If you haven't already done so, read the project description for more information on this subject.

The explanation below aims to outline in (very) broad terms the approach we would like you to adopt for this project.

First steps toward designing a program

When the program is launched, a window should open and display a view of the simulation. Here is one example among many:

item

Various settings (e.g., the temperature in the culture boxes) can be adjusted using graphical menus. In the example above, the simulated culture box (white circle) contains a single type of bacteria (shown here in blue with a flagellum) and sources of nutrients (the yellow or blue “mold” spots). The application will be able to have several types of bacteria (differentiated by distinct graphical representations) coexist in such a box, which will evolve in competition (or symbiosis) for access to nutrients.

It is reasonable to assume that each of these elements on the screen will need to have a C++ equivalent in your code.

When designing the program, it is necessary not only to identify the elements to be modeled, but also to ask a number of questions such as:

Below, we outline the fundamental elements that will be involved in the program to be implemented.

Basic objects

In light of the above description, the following classes seem to be essential:

More specifically, it will quickly become apparent that there are elements common to all bacteria, such as the fact that they have a position in a culture dish and a speed of movement. There will also be differences, for example in behavior: grappling bacteria have different modes of existence than single-flagellated bacteria.

We can therefore imagine a base class (Bacterium) to specify the characteristics and methods common to all bacteria. We will then need to specialize this base class (concept of inheritance) to characterize attributes and methods specific to the different categories of simulated bacteria.

To summarize, we can thus anticipate the different elements involved in the simulation and gradually propose a possible design for the program. As you progress through the project, you will find detailed diagrams explaining the program architecture that we suggest you follow. It is essential to understand this in order to implement it correctly. It is clear that other simpler, more complicated, or simply different solutions exist, and each (simple or complicated) generally has advantages and disadvantages. However, the model we propose is reasonable, and following it will save you time.

Simulation core and graphical displays
To perform the simulation, we will change the environment over time (its bacteria, nutrient sources, etc.).

Time is sampled (we refer to this as discrete time steps). At each time step, each bacterium, for example, may undergo or cause a number of events depending on the context (consume nutrients, divide, die, etc.). These actions determine the evolution of the system over time.

The elements of the system will therefore generally have:

A good design will ensure that these different facets of the program are independent: for example, behavioral aspects must be able to be simulated independently of the graphical display (so that, for example, the graphical interface can be changed without having to change the rest of the program).

The guidelines in the project statement will help you arrive at a design that meets this requirement.

The simulation kernel , which will cause the world to evolve over time and take into account any user interventions, will be provided. This core will enable you to:

A provided Application class will be responsible for this task (it will be available in many variants, through inheritance, to allow you to test different aspects of your program). The operating principle of the simulation kernel will be explained to you in due course. It uses the features of the SFML library, which you have already had the opportunity to practice a little in the practical sessions.

Graphics library

There is no standard library in C++ for defining graphical interfaces. Each of the existing libraries therefore has its own specific features, functionalities, prototypes, etc.

Among the possibilities :

We chose the latter option for its ease of use. It will provide you with the necessary features for graphics and event management in your program.

Support from the teaching team is only guaranteed for the CO rooms environment. If you are working in your own environments, it is essential that your programs also run on the Cosunray thinclients in rooms CO020-CO023.

Registration

If you haven't registered yet, do so before Monday, March 16 at 9 a.m.!


Steps

Create a subdirectory projet (word for "project" in French) in the directory ~/Desktop/myfiles/Programming/cpp. All files related to this project should be located in the directory ~/Desktop/myfiles/Programming/cpp/projet.

A schedule of the different steps is provided in the project description, and below you will find advice on which classes to implement and how to do so. It is recommended that you follow these guidelines, but you can of course add or modify elements as you wish in order to customize your program.

The project is designed to be done in pairs, so share the work as soon as you start to feel comfortable with the subject.
Developing in parallel and in a complementary manner is certainly an instructive experience, but it obviously requires good communication between you to be effective.

Throughout the development process, you can check your program using small test programs. To debug your program, you have two options (which are often used in conjunction):

  1. Use cout (or, much better, cerr) to identify where the program “crashes” and the value of the attributes at that location
  2. use the debugger by compiling your program with the -g option and running it with the command ddd myprogram. This second option (see DDD mini-reference) is essential for certain types of errors.

Important: The statement provided is quite detailed but does not necessarily give all the information. You will therefore need to supplement what you are given with a little personal investigation. The assistants, and in particular your coach, are there to help you. It is also possible that additional information will be provided along the way if necessary .

The necessary archives are provided as and when they become necessary.

Important: Don't forget to comment on your code! Part of the final mark will be based on the comments.


Step 1: Circular contours (warm-up)

Goal: Implement a base class representing circular contours. These will be useful for various essential aspects of the program, such as managing collisions between entities (encounters).

Required concepts: classes, encapsulation, constructors, destructors, and operator overloading

These concepts are explained in lessons 16, 17, and 18.

Estimated coding time: 1 week of supervised lab work (from Tuesday of week 5 inclusive, to Tuesday of week 6 exclusive, according to the numbering in the course outline)

Click here to access the assignment for this part.


Step 2: Culture boxes and nutrients

Goal: Implement the environment in which our future bacteria will evolve. This will essentially consist of a set of culture boxes in which nutrients will grow.

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

These concepts are explained in lessons 16, 17, 18 & 19.

Estimated coding time: 2 weeks of supervised lab work (from Tuesday of week 6 inclusive, to Tuesday of week 8 exclusive, according to the numbering in the course schedule).

Click here to access the assignment for this section.


Step 3: Bacteria enter the scene

Goals:

A first type of bacteria, single-flagellated bacteria, appears. Nutrient sources become differentiated.

Required concepts: classes, constructors/destructors, inheritance, polymorphism

These concepts are explained in lessons 16, 17, 18, 19, 20, and 21.

Estimated coding time: 2 weeks of supervised lab work (from Tuesday of week 8 inclusive to Tuesday of week 10 exclusive, according to the numbering in the course outline).

Click here to access the assignment for this part.


Step 4: Competing bacteria

Goals:

Introduce new types of bacteria that compete for access to nutrients: «grapple» bacteria and bacteria with group movement.

Required concepts: classes, constructors/destructors, inheritance, polymorphism.

These concepts are explained in lessons 16, 17, 18, 19, 20, 21 & 22

Estimated coding time: 2 weeks of supervised practical work (from Tuesday of week 10 inclusive, to Tuesday of week 12 exclusive, according to the numbering in the course plan)

Click here to access the assignment for this part.


Step 5: Differentiated nutrients and statistics

Goals:

Complete the system so as to enable:

  • differentiated interaction of bacteria with different nutrient sources, depending on their type;
  • display of simulation statistics.

Required concepts : classes, constructors/destructors, inheritance, I/O, and standard library.

Estimated coding time: 1 week of supervised lab work (from Tuesday of week 12 inclusive to Tuesday of week 13 exclusive, according to the numbering in the course schedule).

Click here to access the assignment for this part.


Step 6: Extensions

Click here for some suggestions.


Some references

You will also find references on the C++ language here (in French).