乌龟卡在栅格地图中

时间:2019-02-20 12:45:16

标签: gis netlogo

我正在都灵市内进行交通模拟。只能在假定“ stato”和“ strada”精确值的某些补丁上移动海龟。最初,海龟可以在地图(栅格文件)上正确移动,但是在经过几刻之后便会停止,因此不尊重通过“ ifelse”(“走”的)中的“ next-patch”过程将它们归因于它们的方向。 ”)。非常感谢

to setup-turtles
  create-turtles 100

  ask patches with [stato >= 1 and stato <= 4]
  [set strada 1 set done? false ask patches in-radius 4 [set strada 1 set done? false ] ]
  set road patches with [stato >= 1 and stato <= 4 and strada > 0]
  ask turtles [
    set size 10
    set shape "car"
     set casa one-of road
  set ufficio one-of road with [self != [ casa ] of myself ]
 set direzione ufficio
    move-to casa ask patch-here [set done? true]]

end

to go
  ask turtles [
    direzione-turtles
    face direzione ;aggiunto
    ifelse  next-patch != nobody
    [
      face next-patch
      fd 1 ask patch-here [set done? true]]
    [let other-choices neighbors with [strada > 0 and stato <= 4 ]
      move-to one-of other-choices ;al posto di face
      fd 1]]
  tick
end

0 个答案:

没有答案