2015-05-24 32 views
1

我是新的使用NetLogo,我試圖使用網上找到的'Hello World'模型來學習它。我在Mac OS X(Yosemite)上運行NetLogo 5.2。當我嘗試隨機設定的海龜,以這種方式NetLogo沒有任何名稱SCREEN-SIZE-X已被定義

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

我得到這個錯誤:已命名的屏幕-SIZE-X已經定義沒有

屏幕尺寸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 

回答

2

我覺得screen-size-xscreen-size-y是歷史的NetLogo。您可以使用max-pxcormax-pycormin-pxcor,min-pycor獲取世界邊界或world-widthworld-height以獲得大小。

要得到一個隨機位置,有random-xcorrandom-ycor

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

沒錯!謝謝。我一直在閱讀的指南沒有報道這些新功能。 – slash89mf

+1

有很多過時的東西在那裏,只是漂浮在互聯網上。我建議使用http://ccl.northwestern.edu/netlogo/resources.shtml來找到學習資源。 –