如何根据斑块颜色将海龟放置在某些区域内

时间:2017-11-13 10:33:36

标签: netlogo

我的模型有3个品种 - 狼,猎物,牲畜。

我的环境分为3个不同颜色的圆圈,深绿色的中心,周围的浅绿色和周围的绿色。

我已经能够将狼放在他们的“书房”中这很容易,因为它在0'0这么简单的xcor ycor代码被使用了。

但是我如何只将牲畜放在外面的绿色圆圈中,并将猎物种类放在深绿色的中心和浅绿色的第二个圆圈中

以下代码用于设置

to setup

clear-all
ask patches [set pcolor green - 1]
 ask patch 50 50
  [
   set pcolor white
    ask patches in-radius .8 [set pcolor white]
    ask patches in-radius 40 with [pcolor != white] [set pcolor green - 3]
     ask  patches in-radius 50 with [pcolor != white and pcolor != green - 3] [set pcolor green]
    ]

  create-adults 2
  ask adults [ set color black set shape "wolf" setxy 50 50 set energy 32400 set size 1]

   create-subadults 2
  ask subadults [ set color grey set shape "wolf" setxy 50 50 set energy 32400 set size 1]

   create-juveniles 4
  ask juveniles [ set color brown set shape "wolf" setxy 50 50 set energy 15000 set size .8]

    create-prey 40 [ set color brown ]
  ask prey [ set color brown set shape "deer" setxy random-xcor random-ycor set energy 3000 set size 2]

   create-livestock 30
  ask livestock [ set color white set shape "cow" setxy random-xcor random-ycor set energy 20000 set size 2]


set territory-patches patches with [pcolor =  green - 3]
set non-territory-patches patches with [pcolor =  green ]

  reset-ticks

end

0 个答案:

没有答案