让乌龟只在特定的补丁上移动

时间:2018-05-08 18:57:50

标签: netlogo

我在netlogo上相当新,所以这可能看起来像一个愚蠢的问题,但现在是:

我有一个带有特定属性的补丁世界,代表公园,建筑物,街道(2种类型的小型和大型)等等。我希望我的海龟只使用补丁移动到特定点(我设法做到了这一点)代表街道,但倾向于走向公园和绿地。 我想知道你是否可以帮助我让他们只使用代表街道的补丁。

这是我建立我的世界并创造我的乌龟的方式:

    extensions  
[
  gis   
]


globals    
[
  Batiments
  ChemindeFer
  Cimetiere
  Densite
  Eau
  Ponts
  Routes
  TerrainSports
  Vegetations
]


patches-own 
[
  Cheminferroviaire
  Bati
  pont
  TerraindeSport
  Vege
  cimetary
  water
  road
  densitepop
  Npatchvert

]


breed [ Renards renard]
breed [ Proies proie]


Renards-own
[
  stress
  poids
]


Proies-own
[
  weight
]


to setup          
ca                
  initialiserGIS  
  creerRenard
  creerProie
  move
reset-ticks

end



  to initialiserGIS            


  ; ---------------------- chargement densité ----------------------------

  set Densite gis:load-dataset "desite_ind_g.asc"
  gis:apply-raster Densite densitepop

  let min-Densite gis:minimum-of Densite
  let max-Densite gis:maximum-of Densite
   ask patches
  [
    ifelse densitepop >= 1.5
    [ set pcolor scale-color grey densitepop 1.5 6]
    [ set pcolor white ]
  ]


  ;------------------- chargement des chemin de fer ----------------

  set ChemindeFer gis:load-dataset "chdefer_g.asc"
  gis:apply-raster ChemindeFer Cheminferroviaire
  ask patches with [Cheminferroviaire = 1]
  [set pcolor grey]


   ;--------------------- chargement batiments --------------------

  set Batiments gis:load-dataset "batiment_g.asc"
  gis:apply-raster Batiments Bati
  ask patches with [Bati = 1]
  [set pcolor brown]


   ;--------------------- chargement des ponts --------------------

  set Ponts gis:load-dataset "ponts_g.asc"
  gis:apply-raster Ponts pont
  ask patches with [ pont = 1]
  [set pcolor 87]

  ;--------------------- chargement de l'eau ----------------------

  set Eau gis:load-dataset "eau_g.asc"
  gis:apply-raster Eau water
  ask patches with [ water = 1]
  [set pcolor blue]

  ;--------------------- sports field -----------------

  set TerrainSports gis:load-dataset "terrain_sport_g.asc"
  gis:apply-raster TerrainSports TerraindeSport
  ask patches with [ TerraindeSport = 1]
  [set pcolor green]

  ;--------------------- végétation --------------------

  set Vegetations gis:load-dataset "vegetation_g.asc"
  gis:apply-raster Vegetations Vege
  ask patches with [ vege = 1 ]
  [set pcolor green]

  ;--------------------- cimetary --------------------

  set Cimetiere gis:load-dataset "cimetiere_g.asc"
  gis:apply-raster Cimetiere cimetary
  ask patches with [ cimetary = 1 ]
  [set pcolor green]

  ;---------------------- roads ---------------------------

  set Routes gis:load-dataset "routes_g.asc"
  gis:apply-raster Routes road

  ask patches with
  [ road = 4] [set pcolor 87]
  ask patches with
  [ road = 3] [set pcolor 104]
  ask patches with
  [ road = 0] [set pcolor green]


end




to creerRenard

  create-Renards 10

end 

to move

  ; --- 1st mouvement (towards campus) --- 
  ask renards 
  [ set heading towardsxy 10 101 
  fd 1 ]
end

我希望这不是太多的信息.​​.....提前谢谢你!

0 个答案:

没有答案