对其他海龟执行没有影响但加快反应速度的海龟

发布于 2024-08-23 11:40:59 字数 474 浏览 11 评论 0原文

我正在使用 netlogo 中名为化学平衡的现有模型,并添加更多代码。我想添加海龟(催化剂),它对反应/其他海龟没有影响,但会加速前向反应,其定义如下:

to react-forward [t]
  ask t [ set color red ]
  set color green
  rt random-float 360
  jump 2
end

我在想我应该放一个开关和滑块,使海龟变成whitemols或者我做一个海龟自己的[催化剂],然后像我对温度和压力所做的那样定义它。我尝试了以下方法,但没有成功。

turtles-own [speed catalyst]
  crt whitemols
  [ set color white
    randomize
    set speed 1
  ]

我知道上面的代码不正确,但不确定如何编写此特定功能的代码。

I am using an existing model in netlogo called Chemical Equilibrium and am adding some more code. I want to add turtles (catalyst) which have no effect on the reaction/other turtles but speeds up the FORWARD reaction, which has been defined as follows:

to react-forward [t]
  ask t [ set color red ]
  set color green
  rt random-float 360
  jump 2
end

I was thinking that I should put a switch and a slider, make the turtles into whitemols or I do a turtles-own [catalyst] and then define that like I have done with temperature and pressure. I tried the following but it didnt work.

turtles-own [speed catalyst]
  crt whitemols
  [ set color white
    randomize
    set speed 1
  ]

I know the above code is incorrect but am not sure how to code this particular feature.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一张白纸 2024-08-30 11:40:59

当然,有很多方法可以做到这一点。我无法从您包含的小片段中看出您的程序中发生了什么。

一种方法是使用不同品种的催化剂:

breed [catalysts catalyst]
breed [chemical-x chemical-x]
;and so on

;then the forward reaction is sped up by the existence of catalysts

to react-forward
  let num-catalysts count catalysts
  ;speed up by num-catalysts
  ;...
end

There are many ways to do this, of course. I can't tell what is going on in your program from the little snipped you include.

One way would be to have the catalyst be of a different breed:

breed [catalysts catalyst]
breed [chemical-x chemical-x]
;and so on

;then the forward reaction is sped up by the existence of catalysts

to react-forward
  let num-catalysts count catalysts
  ;speed up by num-catalysts
  ;...
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文