预期命令

时间:2017-10-23 20:07:04

标签: netlogo

我认为这是我括号中的某个错误,但我不确定此错误的位置。

to feed
  let prey one-of humans-here
  if prey != nobody [
    [ifelse random-float 1 <= zombie-victory-probability
    ifelse random-float 1 <= conversion-probability
      [ ask prey [ convert ] ]
      [ ask prey [ die ] ]
      [ die ]
  ]]
end

1 个答案:

答案 0 :(得分:1)

很难确定,因为如果没有看到您的设置代码我无法测试,但也许是这样?

to feed
  let prey one-of humans-here

  if prey != nobody [
    ifelse random-float 1 <= zombie-victory-probability  
    [ ifelse random-float 1 <= conversion-probability ; option a1
      [ ask prey [ convert ] ] ; option b1
      [ ask prey [ die  ] ]    ; option b2
    ]   
    [ die ] ; option a2
  ]  
end