So I developed an chloroplast simulation. Mainly a fabrication of my mind. It is probably not based very well on real biology. That is why I need some input. I am going to try my best to describe it in more mathematical and biologist friendly terms, without giving you just sudo-code:

**Rule 1 (Vegy feeding)**

Assuming that Vegy feeding rate is 150, at half the chloroplasts (16K) the robot will be fed:

150 x Current bot radius / Average bot radius (for simplicity the "Current bot radius / Average bot radius" ratio is bypassed in my simulation (see off-topic)

**Rule 2 (Add more chloroplasts)**

The number, let us call it 'N'. Is subtracted from the robots energy (for simplicity energy and body are simply treated as energy in my simulation.)

Next, N gets multiplied by the exchange rate (4 in my simulation)

Next, We get the current chloroplast amount, let call this 'C.' Max number if chloroplasts is 32K

Next, N gets multiplied by (32000 - C) / 32000 This is done so it will be difficult for a veg. to maintain chloroplasts the more chloroplasts it has.

Finally, the resulting value is added to chloroplasts.

**Rule 3 (How does the robot lose chloroplasts?)**

First we need to figure out how much chloroplasts the robot just turned into energy, lets call this E

E is equal to C / 16000 * vegy_feeding_rate

Then, we divide E by 4 (our exchange value)

Finally, we divide E by ( (32100 - C ) / 32000 ) This is done so chloroplast loss has a half life.

E gets subtracted from the current amount of chloroplasts.

Finally, if C falls below a certain point (75 in my simulation) the robot gets 'up-rooted' and instantly looses all its chloroplasts.

**Rule 4 (Removing chloroplasts or setting them at a certain value)**

Remove is similar to 'Add more chloroplasts' but the resulting value is subtracted from chloroplasts.

And also, the initial value 'N' is added to energy.

If you want to set chloroplasts to a certain value, the program figures out the difference, and ether performs Add or Remove chloroplasts.

The reason I developed this, was because the existing algorithms where too liner in nature.