Determining max, min and mean turtle cluster size, as well as number of turtle clusters in netlogo

南笙酒味 提交于 2019-12-02 11:24:51

When you run the code, NetLogo highlights the line that generates the error. The problem line is print max cluster-size-growth. If you look earlier, you have let cluster-size-growth cluster-size + 1 and let cluster-size 1 prior to that. So cluster-size-growth is 1 + 1, or the number 2. The variable cluster-count-growth is also a number.

I think (but am not sure) that you are trying to calculate these two variables for each turtle and then take the max/mean/min over the turtles of the same type. If so, you need to create the variable for all the turtles first (that is, end the ask [] statement), and then do something like print max cluster-size-growth of base-settlers. You may also need to establish turtle-own variables for these as the local variable values will be lost at the end of the ask [] block.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!