I am here to present to you a mathematical problem, to which my lack of knowledge in this field does not allow me to find a solution.
In most cases everything goes as I wish.

Are those numbers integers or float? Which ones are inputs which results?
If all inputs and outputs are integer, and that is every state you can get, just make simple graph, that checks for NSP and NS inputs, then gives result.
For eg:
in sequence check:
if nsp=4 and ns=2 then index = 0
if nsp=3 and ns=3 then index = 1
if nsp=4 and ns=4 then index = 2

put in 3 arrays all 3 results:
Rst NS2 = 3 , 2, 1]
Rst NS3 = 2 , 3, 4]
Rst NS4 = 6 , 6, 8]

then get results array[index] for each result

but i am assuming what is input and what is output also that all are integers.

Variables with the name “Rst” are all calculation results
The variables are of the integer type
The entries are:

N Solide = Amount of food contained by a plant.
NS Solide = Quantity worn by the character.
MAX N Solide = Maximum quantity that can be worn by the character.

I think that the problem is in my resonance, that it is the logic of calculation which is in question. If I put the results in an index the problem remains, the equation is bad.
But can you please tell me how to relate an array to check the inputs and give the result?

No I could not write it in equation, I do not have the knowledge for that.

But…

After having tried I modified the termination of my assembly and added a calculation between the «Rst NS 4» the Max n. Solid, so that if the RST NS 4 is larger than The portable maximum this one is subtracted from the Rst NS4.

You really should have equation before you make some calculations like this. For now you probably can manage this by trial and error, but later fixing anything in this game will be nightmare.

Not knowing how to make an equaton, I am afraid that the result will be slightly distorted
Cepandantke will try to put this in writing. But really I don’t see how it would be clearer than a visual graph as it is presented here … for me anyway

The character (an insect) comes to collect its food (N. Solide) on the plant which produces it. He has, as you understand it, a maximum amount of food that he can carry (Max N solide), it is taken into account what he already carries (NS Porté), because since the food is random we cannot find not necessarily the (Max N. Solide).

I set up a random system of the number of food available on the plant:

The principle after that is that the number of food and subtracted from the pante and added to the character (NS Porté), but must not exceed the “max N solide” amount. If it is exceeded the difference is left on the plant.

I suspect that the code can be clearer and above all simpler, but I did that with my little beginner means.

If there is a possibility of simplifying, I am interested !