在netlogo ifelse函数中设置变量并让乌龟在补丁中等待

时间:2014-04-25 13:36:49

标签: countdowntimer netlogo

我在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
] ]]]
]

1我想添加一些条件(设置.........)如果乌龟会移动到黄色,还有一些其他条件,如果它会移动到绿色,例如

 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个滴答)。我应该在这个模型中加入这两个问题吗?

1 个答案:

答案 0 :(得分:0)

第一部分的代码对我来说很好看。你试过吗?我说去吧!

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