嗨,我正在做一个模型,我需要使用时间变量的值做一个元素列表。这是我用来定义我的时间变量的代码与时间变量做一个列表,并选择随机的那些元素
to react
ask cells
[
let Ai1 count turtles with [color = blue and xcor < -13 and ycor > -26]
let Ai2 count turtles with [color = blue and xcor < -13 and ycor < -27]
let Ai3 count turtles with [color = blue and xcor > -12 and xcor < 11 and ycor > -26]
let Ai4 count turtles with [color = blue and xcor > -12 and xcor < 11 and ycor < -26]
let Ai5 count turtles with [color = blue and xcor > 11 and ycor > -26]
let Ai6 count turtles with [color = blue and xcor > 11 and ycor < -26]
let Aimax list (Ai1 Ai2 Ai3 Ai4 Ai5 Ai6)
set calories (44.5 * random Aimax)
]
end
所以我需要做AI1到AI6值的列表,然后选择ramdomly这6个数值之一,在未来使用它时间变量Aimax的乘法如此可能做到这一点?如果我使用随机命令,它可以用在列表中? Tks阅读。
谢谢,我认为这只能与海龟和补丁一起使用,不适用于任何种类的代理列表。任何建议集合变量?因为命令“list”仅适用于不具有临时变量的常量。 –
我弄清楚如何制作列表。我使用“句子”命令将3个变量分组,首先将2个临时变量分组,然后再与另一个变量分组。我将其与其他3个时间变量进行了对比,最后加入他们列出了6个时间变量。我这样做是因为它通过这个命令表明它不能与其他更多项目一起加入2个项目列表,因此我需要制作2个相同数量项目(3)的列表并使用“句子“把他们分组。 –