netlogo - 如何在 Netlogo 中创建与海龟列表的链接
问题描述
我想用特殊的海龟列表从海龟 0 创建链接,例如 [2 7 6 5] 。此列表包含谁的海龟
ask turtle 0 [
create-link-with [2 7 6 5]
let result requester-list
ask turtle 0 [
create-links-to result
解决方案
作为一般经验法则,不要who
在 NetLogo 中使用。您不提供生成该who
数字列表的代码,但最好有海龟列表,而不是海龟标识符列表。
这是一种方法(未经测试)。有更好的方法,但我认为这更具可读性:
foreach [2 7 6 5]
[ this-turtle ->
ask turtle 0 [create-link-with turtle this-turtle ]
]
如果您改为使用代理集,您的代码将看起来更像这样:
let targets n-of 4 turtles
ask turtle 0 [create-links-with targets]
推荐阅读
- python - 编写第二个函数后代码一直输出空白文本文件
- database - 如何将 xampp 数据库连接到远程服务器?
- javascript - Angular 6 - 员工:可观察
; 控制台反应不好 - windows - Windows XP 64 上的 LoadLibrary() 在 SysWow64 中找不到 DLL,除非它在路径中?
- java - 这段代码不起作用,我做错了什么?无法创建 com.example.myapplication.MainViewActivity 类的实例
- azure - 如何在 Kusto 中将十六进制字符串转换为 Ascii 字符串
- linux - 我正在尝试向 Linux 内核添加系统调用
- python - 如何使用 Python 显示实时数据
- android-webview - android,如何在不使用 javascript 的情况下监控 webview 内容大小的变化
- javascript - 尝试使用 HTML 在我的问题左侧添加“是”“否”标签