gpt4 book ai didi

netlogo - 我怎样才能让一只乌龟数出有多少只乌龟自身值(value)比我大呢?

转载 作者:行者123 更新时间:2023-12-02 12:29:43 25 4
gpt4 key购买 nike

如何让一只乌龟数出自己的值比自己大的其他乌龟的数量?

我做了一个行人评估模拟。在这个模型中,有一个乌龟自己的值[dis-door1],表示乌龟到门1的距离。我必须数一下[dis-door1]比我小的其他海龟的数量,但我失败了。这是我尝试执行此操作的代码:

ask people[
set dis-door1 distancexy 15 0
set dis-door2 distancexy 0 15
set density1 (count people with [([dis-door1] of other people) < ([dis-door1] of myself)]) / [dis-door1] of myself
set density2 (count people with [([dis-door2] of other people) < ([dis-door2] of myself)]) / [dis-door2] of myself
]

我希望有人能帮忙做到这一点。

最佳答案

您的代码大部分是正确的。

尝试以下操作。本质上,我删除了我自己的外部,因为我自己的引用是指调用者的调用者——您可以在询问人们的范围内直接访问 dis-door1 [...这里.. .]

ask people[
set dis-door1 distancexy 15 0
set dis-door2 distancexy 0 15
set density1 (count people with [([dis-door1] of other people) < ([dis-door1] of myself)]) / dis-door1
set density2 (count people with [([dis-door2] of other people) < ([dis-door2] of myself)]) / dis-door2
]

关于netlogo - 我怎样才能让一只乌龟数出有多少只乌龟自身值(value)比我大呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56423851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com