1
請檢查此代碼。哪一部分是錯誤的IfElse嵌套不工作
to catch-lizards
let prey one-of lizards-here
ifelse prey = "lizard2"
[ show "WRONG" ask prey [die]
set lifetime = lifetime + hawks-life-gain ]
[ifelse droping-tail? = true
[ask prey [set shape "lizard2"
set lifetime lifetime + hawks-life-gain/4 ] ]
[ask prey [die]
set lifetime lifetime + hawks-life-gain ]
]
]
end
問題在哪裏(顯示「錯誤」)被寫入。該部分不執行。語法不正確?
我想檢查捕食形狀LIZARD2。那是條件。我怎麼做? PREY是agentset,LIZARD1,LIZARD2是它的形狀。我想在某些條件下交換這些形狀。 –