目前,我正在为卡车在我的netlogo土地内行驶建造一条路线。当卡车靠近它应该交付的商店补丁时,卡车需要改变它的动作。
但是我的if
orifelse
声明似乎没有很好的反应,答案取决于输出。通过一些测试:
*turtles> ifelse ((patch (first dirx) (first diry)) = one-of neighbors4) [write "11"] [write "22"]
"11"*
*turtles> ifelse ((patch (first dirx) (first diry)) = one-of neighbors4) [write "111"] [write "122"]
"122"*
*turtles> ifelse (patch (first dirx) (first diry)) = one-of neighbors4 [write "111"] [write "122"]
"122"*
*turtles> ifelse (patch (first dirx) (first diry)) = one-of neighbors4 [write "11"] [write "12"]
"12"*
*turtles> ifelse (patch (first dirx) (first diry)) = one-of neighbors4 [write "11"] [write "22"]
"11"*
请注意,在此期间我不移动我的卡车,我使用指挥中心提出这些问题(从乌龟卡车的角度来看)。
我对此感到非常困惑。因为我唯一改变的是动作(写什么)。这不应影响真/假陈述本身。
有没有人知道这里发生了什么以及为什么ifelse
反应很奇怪?