【问题标题】:NetLogo nothing named SCREEN-SIZE-X has been definedNetLogo 没有定义任何名为 SCREEN-SIZE-X 的内容
【发布时间】:2015-05-24 20:04:32
【问题描述】:

我是使用 NetLogo 的新手,我正在尝试使用网上找到的“Hello World”模型来学习它。我在 Mac OS X (Yosemite) 上运行 NetLogo 5.2。当我尝试随机设置海龟时,以这种方式

setxy random screen-size-x random screen-size-y

我收到此错误:没有定义任何名为 SCREEN-SIZE-X 的内容

screen-size-x 以大写形式出现,因此我在此内置函数上出现错误。谁能帮我?谢谢

这是我正在使用的 NetLogo 代码:

globals [buttons]           ; Global variables

to setup                    ; Initializes model for new run.
    set-default-shape turtles "circle" ; Turtles are circles
    clear-all                          ; Reset turtles and patches
    set buttons 500                    ; Set number of buttons to 500
    create-turtles (buttons)           ; Create "buttons" number of turtles
    ask turtles [setup-turtles]        ; Initialize each turtle
end

to setup-turtles            ; Called for each turtle during setup
    setxy random screen-size-x random screen-size-y ; Set our x,y randomly
end

【问题讨论】:

    标签: netlogo screen-size


    【解决方案1】:

    我认为screen-size-xscreen-size-y 是NetLogo 的历史。您可以使用max-pxcormax-pycormin-pxcormin-pycor 获取世界边界或使用world-widthworld-height 获取大小。

    要获得随机位置,有random-xcorrandom-ycor

    to setup-turtles  
      setxy random-xcor random-ycor
    end
    

    【讨论】:

    • 没错!谢谢你。我一直在阅读的指南中没有报告这些新功能。
    • 有很多过时的东西,只是在互联网上流传。我建议使用ccl.northwestern.edu/netlogo/resources.shtml 来查找学习资源。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-08
    相关资源
    最近更新 更多