Turtles, patches and their moving sequentially from one patch to the next

北城以北 提交于 2019-12-01 14:38:56

Have you tried to understand the answers you have already been given? In the setup, replace -10 5 with the first place you want to go to (which is -12 8). Then update the go code accordingly.

to go
  ask flag-on patch -12 8
  [ set target patch -5 12
    face target
  ]
  ask flag-on patch -5 12
  [ set target patch 6 4
    face target
  ]
  ask flag with [ shape = "by" ]
  [ forward 1 ]
end

This is just the direction and moving. You need to try and do some code for the energy and dying etc. But do things gradually, get something working and then add the next piece.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!