2014-09-25 72 views
-1

我想模擬開門的房間。我希望使用代理,而不是使用補丁。netlogo中的Wall代理

我之前採用的方法是首先創建一個帶有間隙的盒子,然後在其上分佈代理。 但它似乎沒有給出結果。

Netlogo Sprouting turtles at regular intervals

Netlogo Sprouting turtles spaced at less than one patch

以上是大致繪製圖。 enter image description here

注意: 更容易做到這一點將在每個補丁發芽烏龜。但我不需要。相反,我希望讓海龜變小一點,而不是一個補丁。 謝謝。

問題:沿着矩形的邊緣分佈海龜(具有如圖所示的間隙),並且分佈可以根據期望的海龜密度而變化。

+0

那麼,什麼是你的問題?這似乎在你到達實際提問的部分之前就結束了。 – 2014-09-25 13:22:06

+1

@SethTisue請檢查我已經說得更清楚了。 – 2014-09-25 14:48:04

+0

現在的問題更加清晰,但您仍然缺乏自己完成某些工作的部分,而不是隻是要求其他人爲您編寫代碼。試着自己解決;如果您遇到困難,請發佈您編寫的代碼,解釋您正在嘗試採取的方法,並解釋確切地說明您陷入困境的原因以及原因。 *這是一個問題。 – 2014-09-26 04:46:22

回答

1

下確實在將來萬一有人工作面臨着這樣一個問題:

set breadth-patches patches with[(pycor > (-(breadth)) and pycor < breadth and pxcor = lengthrec) or(pycor > (-(breadth)) and pycor < breadth and pxcor = (-(lengthrec))) ] 
    set length-patches patches with[(pxcor > (-(lengthrec)) and pxcor < lengthrec and pycor = (-(breadth - 1))) or (pxcor > (-(lengthrec)) and pxcor < lengthrec and pycor = (breadth - 1))] 
    set gap-patches patches with [pxcor > (gap * (-1)) and pxcor < gap and pycor =(breadth - 1)] 
    set length-patches length-patches with [not member? self gap-patches] 



ask breadth-patches[ 

sprout-walls 1[set color 2 
    set size 0.5 set heading 180 fd 0.25 
    if-else(pxcor < 0)[set heading 90][set heading 270] fd 0.25] 
sprout-walls 1[set color 2 
    set size 0.5 set heading 360 fd 0.25 
if-else(pxcor < 0)[set heading 90][set heading 270] fd 0.25] 

] 
    ask length-patches[ 

    sprout-walls 1[set color 2 
     set size 0.5 set heading 90 fd 0.25 
     if-else(pycor < 0)[set heading 180][set heading 0] fd 0.25 
     ] 
    sprout-walls 1[set color 2 
    set size 0.5 set heading 270 fd 0.25 
     if-else(pycor < 0)[set heading 180][set heading 0] fd 0.25 
    ] 
    ] 
end