to change-vgags
ifelse (((-0.007333 * x * x) + (0.07333 * x) + 1) = 1)
[stop]
[ifelse (((-0.007333 * x * x) + (0.07333 * x) + 1) > 1)
[ask n-of (((((-0.007333 * x * x) + (0.07333 * x) + (1)) / 48) - (1 / 48)) * 590) gags with [pcolor = red - 2] [ hatch 1 ]]
[ask n-of (((1 / 48) - (((-0.007333 * x * x) + (0.07333 * x) + 1) / 48)) * 590) gags with [pcolor = red - 2] [die]]]
The top code is an existing functioning code that I have. Since the gags decrease, they will follow the last equation that tells them to die. However, I get to a point where it wants 15 gags to die, but I only have 10 left in the agentset. So I tried to add a new line of code directly after, but it is still giving me the same problem, so obviously, it isn't right. The line of code that I wrote is written below.
if (((1 / 48) - (((-0.007333 * x * x) + (0.07333 * x) + 1) / 48)) * 590) > count gags with [pcolor = red - 2] [ask gags with [pcolor = red - 2] [die]]
end
If anyone has any advice on how to fix this problem, I would greatly appreciate it! Thanks in advance!
Replace:
with:
or if that seems a bit hard to read, you could always: