【问题标题】:setting variable in netlogo ifelse function and making turtle to wait in the patch在 netlogo ifelse 函数中设置变量并使海龟在补丁中等待
【发布时间】:2014-04-25 13:36:48
【问题描述】:

我在 netlogo 中有以下内容

ask m-depts [ ; this check the values of turtles against some set numbers 
ifelse 
 (m- k >= 5) and (m-t >= 3) and (m-c >= 3 ) and (m-s >= 4) and (m-b >= 3) and (m-d >= 0) [
move-to one-of patches with [pcolor = yellow]  
] [
 ifelse 
 (m-k >= 5) and (m-t  >= 5) and (m-c  >= 5 ) and (m-s >= 5) and (m-b >= 3) and (m-d >= 1) [
move-to one-of patches with [pcolor = green]    
] [
  action-m-depts
] ]]]
]

第一个我想添加一些条件(设置………)如果海龟会变成黄色,还有一些其他条件如果它会变成绿色,例如

 If pcolor = yellow [
    set m-k m-k + 0.5
    set m-t m-t + 1 
    ] ; 
 If pcolor = green [
    set m-k m-k + 0.8
    set m-t m-t + 2 
  ] ; etc  otherwise do action-m-depts (defined elsewhere)

第二步对于下一步(滴答声)我想修复乌龟等待补丁例如(对于黄色补丁,等待 5 年(5 个滴答声),对于绿色补丁等待 2 年(2 个滴答声)。如何我应该将这两个问题合并到这个模型中吗?

【问题讨论】:

标签: countdowntimer netlogo


【解决方案1】:

第一部分的代码对我来说看起来不错。你试过了吗?我说去吧!

第二部分与netlogo: how to make turtles stop for a set number of ticks then continueMaking turtles wait x number of ticks 非常相似——看看这些答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 2015-11-27
    • 2014-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多