问题标签 [netlogo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
134 浏览

netlogo - 重载 NetLogo 中的函数

我正在 NetLogo 中开发一个最终会有多种排列的模拟。最后,我将拥有Sim1.nlogo, Sim2.nlogo, Sim3.nlogo, 等等,包括libsim.nls.

我想知道的是,如果我有一个libsim.nls除了我的一个模型之外的所有模型都相同的函数,我可以在不同的模型中重载它,还是我必须在每个排列中手动复制代码?

0 投票
1 回答
370 浏览

netlogo - 排成一排并被空补丁分隔的网络标志代理必须死

想象一下,我有相同品种的乌龟,它的位置如下所示,并被一个空的补丁隔开。

生成随机位置时。假设位置 2 是目标,我希望所有位于 1 2 3 4 的代理都死掉,因为它们都应该连接在一起。同样,如果选择了位置 5 或 6,则 5 和 6 将死亡。

我尝试使用链接和邻居,但它们似乎不起作用。当我尝试它时,位置 4 和 3 的海龟是唯一会死的人。

下面是我用来链接海龟的代码:

下面是我用来杀死乌龟的代码:

0 投票
2 回答
919 浏览

java - java中的网络标志

我需要创建一个大型库来确定海龟的行为,并且需要一个界面来显示它们完成行为后的结果。是否可以在 Netbeans 中运行 Netlogo?如果可能的话,它是否会在一段时间后产生问题,例如无法访问代码、放慢速度或其他任何问题?

0 投票
2 回答
547 浏览

procedure - Netlogo 随机选择 3 个程序之一

如何随机选择 3 个程序之一?

请看下面:

谢谢你。我对语法很陌生。

0 投票
1 回答
9204 浏览

random - 如何使用 netlogo 生成 0.3 < X < 0.7 范围内的数字

正如标题所暗示的,希望生成一个介于 0.3 < x < 0.7 之间的随机浮点数。

我目前使用 while 循环来检查随机浮点数是否在该范围内。我想知道是否有更好的方法来做到这一点。

0 投票
1 回答
140 浏览

netlogo - NetLogo 的 LeJOS 扩展

我是 Lejos 的新手,有一个简短的问题。是否有任何 LeJOS 扩展可以与 NetLogo 结合使用?我需要用 Netlogo 运行 Lejos 并将它们都插入 Eclipse。但我不能在 java 中使用 Netlogo。所以我想知道是否可以将 LeJOS 作为扩展名添加到 Netlogo 中。谢谢。

0 投票
1 回答
120 浏览

max - 如何在 NetLogo 模拟期间保存记者的最大值?

我正在基于 Rebellion 模型在 NetLogo 中运行模拟,其中一些代理变得活跃,但可以被其他代理停用。

我的问题是,如何保持活跃代理的最高价值?当所有代理都被停用时,模拟结束。我在模拟过程中计算了活跃代理的数量:

使用 [active?] 计数代理,

但我想不通,如何保存这个数字的最高值。我知道,我可以在每一步测量跑步,但由于重复次数,我宁愿只保存这个最大次数。

问候,马切克。

0 投票
0 回答
519 浏览

php - 什么时候 tag is loaded with ajax, it fails to initialize

I've got a page with a preview image on it, and when you click the preview image, JQuery replaces it with a Java applet using the ajax load() function. The applet comes up alri

I've got a page with a preview image on it, and when you click the preview image, JQuery replaces it with a Java applet using the ajax load() function. The applet comes up alright (it's netlogo) and seems to find the .nlogo file it's looking for.

This .nlogo filename is passed to the applet with a <param> tag. The applet is generic, and it will load any .nlogo file and run it just like the NetLogo desktop application.

It doesn't display anything however. I know it's finding the file, because when I pass it a bad filename, it throws an error, and right now it's not throwing one.

It works fine if the code is just placed in the html normally, but when it is loaded with ajax the applet does not initialize correctly.

I'm guessing that the applet is waiting for some kind of page-finished-loading event that's not ever going to happen. Is there any way I can fake that message?

The code is distributed all over the place but here are the relevant parts

The div I'm messing with

The JQuery that replaces the preview image with the applet

The applet code that get's sent down for the ajax request

God I hope someone has a shred of knowledge about this :/


It looks like you have just got the syntax of your filter a bit wrong. You need to use an "attribute equals" selector:

Currently you are looking for any element of type unselectable that is a descendant of a td element, and using a pseudo-selector called :off, neither of which exists.

0 投票
1 回答
1653 浏览

list - 将带空格的文件行作为列表读入 NetLogo

如何将由空格分隔的文件内容作为列表读入 NetLogo?例如,使用包含以下数据的文件:

我想创建如下列表:

0 投票
1 回答
410 浏览

netlogo - 为 NXT 砖分组 RGB 颜色

我正在尝试在 netlogo 中为 Nxt 砖编写扩展。为了连接砖块,我使用的是 Lejos。我的颜色传感器有问题。我想编写一个简单的方法,将传感器颜色作为数字返回,例如黄色:1、红色:2 等。但是传感器电机总是在同一表面上返回不同的 RGB 颜色。例如,我把它放在一张黄纸上,rgb 颜色是:[236 189 104],[247 202 108].. 如果它返回相同表面颜色的唯一 RGB 数字,我会根据 RGB 颜色范围对它们进行分类并给出每种颜色的唯一编号。你知道我该怎么做吗?此外,它不会在不同的表面上运行。只为我的纸张颜色(黄色、蓝色、绿色)这样做就足够了。谢谢。