Code center > Bugs and fixes

Veggie pop control

<< < (2/2)

PurpleYouko:
The trouble is in the hierarchy of the program.

The way reproduction works is that when a robot activates a repro gene, it is added to an array of "robots that will reproduce on this cycle" and then the program moves on to the next robot.
Later after all the main routines have been processed (including the one that counts the veggies), it moves onto the repro array and goes through them all one by one, form low robot number to high.

Who gets to repro and who doesn't?

If we set it to cut off when the cap is reached then all the lower number bots will reproduce while the higher ones won't.
Random access to the list will take too long to process.
Nums new feature only allows each one to repro if it meets a certain criteria based on a random number (1 in 100) a bit like mutations. It shuld be a good compromise, particularly if the repro chance can be set in the control panel.

Greven:
Okay sounds better to me :)

Numsgil:
Just thought I'd post the code for you to look at:


--- Code: ---If rob(n).Veg = True And totvegs > SimOpts.MaxPopulation Then
    t = Random(0, totvegs - SimOpts.MaxPopulation)
    totvegs = totvegs + 1
    If t > 0 Then Exit Sub 'attempt to stop veg overpopulation but will it work?
  ElseIf rob(n).Veg = True Then
    totvegs = totvegs + 1
  End If
--- End code ---

PurpleYouko:
Why not just set it up so that veggies always have to pass a random check before reproducing. We can set the chance of them reproducing in the options.
As they exceed the maxpop the chance can just get progressively smaller.

Could be a useful way to control explosive populations of veggies.

Navigation

[0] Message Index

[*] Previous page

Go to full version