📌  相关文章
📜  netlogo 墙 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:45:00.692000             🧑  作者: Mango

代码示例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